diff --git a/packages/fes-plugin-windicss/src/index.js b/packages/fes-plugin-windicss/src/index.js
index 6add0d27..ee6c8311 100644
--- a/packages/fes-plugin-windicss/src/index.js
+++ b/packages/fes-plugin-windicss/src/index.js
@@ -13,15 +13,31 @@ export default (api) => {
}
});
- api.addEntryImportsAhead(() => [{ source: 'windi.css' }]);
+ api.addEntryImportsAhead(() => [{ source: 'windi-base.css' }, { source: 'windi-components.css' }, { source: 'windi-utilities.css' }]);
- api.chainWebpack((memo) => {
+ api.chainWebpack((memo, { createCSSRule }) => {
memo.plugin('windicss').use(WindiCSSWebpackPlugin, [
{
config: resolve(__dirname, '../windi.config.js'),
...api.config.windicss
}
]);
+ if (api.env === 'development') {
+ memo.module.rule('css').test((path) => {
+ if (path.endsWith('windi-utilities.css')) {
+ return false;
+ }
+ return /\.css$/.test(path);
+ });
+ createCSSRule({
+ lang: 'windicss',
+ test: /windi-utilities.css$/,
+ styleLoaderOption: {
+ insert: 'body'
+ }
+ });
+ }
+
return memo;
});
};
diff --git a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js
index e09cba79..24fd6f67 100644
--- a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js
+++ b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/css.js
@@ -19,14 +19,14 @@ function createRules({
test,
loader,
options,
- browserslist
+ browserslist,
+ styleLoaderOption
}) {
function applyLoaders(rule, isCSSModules) {
if (isDev) {
rule.use('extra-css-loader')
.loader(require.resolve('style-loader'))
- .options({
- });
+ .options(Object.assign({}, styleLoaderOption));
} else {
rule.use('extra-css-loader')
.loader(require('mini-css-extract-plugin').loader)
@@ -110,13 +110,12 @@ export default function createCssWebpackConfig({
browserslist
});
- webpackConfig.plugin('extra-css')
- .use(require.resolve('mini-css-extract-plugin'), [{
- filename: isDev ? '[name].css' : '[name].[contenthash:8].css',
- chunkFilename: isDev ? '[id].css' : '[id].[contenthash:8].css'
- }]);
-
if (!isDev) {
+ webpackConfig.plugin('extra-css')
+ .use(require.resolve('mini-css-extract-plugin'), [{
+ filename: '[name].[contenthash:8].css',
+ chunkFilename: '[id].[contenthash:8].css'
+ }]);
webpackConfig.optimization
.minimizer('css')
.use(require.resolve('css-minimizer-webpack-plugin'), [{}]);
diff --git a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js
index 6ee2a43e..e617db70 100644
--- a/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js
+++ b/packages/fes-preset-built-in/src/plugins/commands/webpackConfig/index.js
@@ -20,7 +20,7 @@ function getTargetsAndBrowsersList({ config }) {
}, {});
const browserslist = targets.browsers
- || Object.keys(targets).map(key => `${key} >= ${targets[key] === true ? '0' : targets[key]}`);
+ || Object.keys(targets).map(key => `${key} >= ${targets[key] === true ? '0' : targets[key]}`);
return {
targets,
diff --git a/packages/fes-template/src/pages/index.vue b/packages/fes-template/src/pages/index.vue
index 4ea7e8a2..ec5f7c64 100644
--- a/packages/fes-template/src/pages/index.vue
+++ b/packages/fes-template/src/pages/index.vue
@@ -1,17 +1,16 @@
home
+ Button
-
-{
- "name": "index",
- "title": "$home"
-}
-
+