globalCSS.js
1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _react() {
const data = _interopRequireDefault(require("react"));
_react = function _react() {
return data;
};
return data;
}
function _utils() {
const data = require("@umijs/utils");
_utils = function _utils() {
return data;
};
return data;
}
function _path() {
const data = require("path");
_path = function _path() {
return data;
};
return data;
}
var _utils2 = require("../utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _utils().createDebug)('umi:preset-build-in:global-css');
var _default = api => {
const paths = api.paths,
winPath = api.utils.winPath;
const _paths$absSrcPath = paths.absSrcPath,
absSrcPath = _paths$absSrcPath === void 0 ? '' : _paths$absSrcPath,
_paths$absTmpPath = paths.absTmpPath,
absTmpPath = _paths$absTmpPath === void 0 ? '' : _paths$absTmpPath;
const files = ['global.css', 'global.less', 'global.scss', 'global.sass', 'global.styl', 'global.stylus'];
const globalCSSFile = (0, _utils2.getGlobalFile)({
absSrcPath,
files
});
debug('globalCSSFile', globalCSSFile);
api.addEntryCodeAhead(() => `${globalCSSFile.map(file => `require('${winPath((0, _path().relative)(absTmpPath, file))}');`).join('')}`);
};
exports.default = _default;