mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
18 lines
617 B
JavaScript
18 lines
617 B
JavaScript
import { relative, join } from 'path';
|
|
import { existsSync } from 'fs';
|
|
|
|
export default (api) => {
|
|
const {
|
|
paths,
|
|
utils: { winPath },
|
|
} = api;
|
|
const { absSrcPath = '', absTmpPath = '' } = paths;
|
|
const files = ['global.css', 'global.less', 'global.scss', 'global.sass', 'global.styl', 'global.stylus'];
|
|
const globalCSSFile = files
|
|
.map((file) => join(absSrcPath || '', file))
|
|
.filter((file) => existsSync(file))
|
|
.slice(0, 1);
|
|
|
|
api.addEntryCodeAhead(() => `${globalCSSFile.map((file) => `import '${winPath(relative(absTmpPath, file))}';`).join('')}`);
|
|
};
|