mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
feat: 添加 global css 的能力
This commit is contained in:
parent
4b019a0688
commit
c65e1c089c
@ -28,6 +28,7 @@ export default function () {
|
|||||||
require.resolve('./plugins/features/extraBabelPresets'),
|
require.resolve('./plugins/features/extraBabelPresets'),
|
||||||
require.resolve('./plugins/features/extraPostCSSPlugins'),
|
require.resolve('./plugins/features/extraPostCSSPlugins'),
|
||||||
require.resolve('./plugins/features/html'),
|
require.resolve('./plugins/features/html'),
|
||||||
|
require.resolve('./plugins/features/globalCSS'),
|
||||||
require.resolve('./plugins/features/inlineLimit'),
|
require.resolve('./plugins/features/inlineLimit'),
|
||||||
require.resolve('./plugins/features/lessLoader'),
|
require.resolve('./plugins/features/lessLoader'),
|
||||||
require.resolve('./plugins/features/mountElementId'),
|
require.resolve('./plugins/features/mountElementId'),
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
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.stylus'
|
||||||
|
];
|
||||||
|
const globalCSSFile = files
|
||||||
|
.map(file => join(absSrcPath || '', file))
|
||||||
|
.filter(file => existsSync(file))
|
||||||
|
.slice(0, 1);
|
||||||
|
|
||||||
|
api.addEntryCodeAhead(
|
||||||
|
() => `${globalCSSFile
|
||||||
|
.map(file => `require('${winPath(relative(absTmpPath, file))}');`)
|
||||||
|
.join('')}`
|
||||||
|
);
|
||||||
|
};
|
0
packages/fes-template/src/global.css
Normal file
0
packages/fes-template/src/global.css
Normal file
Loading…
x
Reference in New Issue
Block a user