From 5747466c43ee6cb76dc090f9862a38fe38884bdf Mon Sep 17 00:00:00 2001 From: winixt Date: Thu, 18 Nov 2021 10:31:01 +0800 Subject: [PATCH] feat: windicss --- docs/.vuepress/configs/sidebar/en.ts | 1 + docs/.vuepress/configs/sidebar/zh.ts | 1 + docs/reference/plugin/plugins/windicss.md | 28 +++++++++++++++++++ docs/zh/reference/plugin/plugins/windicss.md | 28 +++++++++++++++++++ packages/fes-plugin-windicss/src/index.js | 11 ++++++-- .../windi.config.js | 0 packages/fes-template/src/pages/index.vue | 10 +++---- 7 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 docs/reference/plugin/plugins/windicss.md create mode 100644 docs/zh/reference/plugin/plugins/windicss.md rename packages/{fes-template => fes-plugin-windicss}/windi.config.js (100%) diff --git a/docs/.vuepress/configs/sidebar/en.ts b/docs/.vuepress/configs/sidebar/en.ts index b4128596..2a45f895 100644 --- a/docs/.vuepress/configs/sidebar/en.ts +++ b/docs/.vuepress/configs/sidebar/en.ts @@ -61,6 +61,7 @@ export const en: SidebarConfig = { '/reference/plugin/plugins/request.md', '/reference/plugin/plugins/vuex.md', '/reference/plugin/plugins/qiankun.md', + '/reference/plugin/plugins/windicss.md', '/reference/plugin/plugins/sass.md', '/reference/plugin/plugins/editor.md', ], diff --git a/docs/.vuepress/configs/sidebar/zh.ts b/docs/.vuepress/configs/sidebar/zh.ts index 6991f9c6..00963d75 100644 --- a/docs/.vuepress/configs/sidebar/zh.ts +++ b/docs/.vuepress/configs/sidebar/zh.ts @@ -61,6 +61,7 @@ export const zh: SidebarConfig = { '/zh/reference/plugin/plugins/request.md', '/zh/reference/plugin/plugins/vuex.md', '/zh/reference/plugin/plugins/qiankun.md', + '/zh/reference/plugin/plugins/windicss.md', '/zh/reference/plugin/plugins/sass.md', '/zh/reference/plugin/plugins/editor.md', ], diff --git a/docs/reference/plugin/plugins/windicss.md b/docs/reference/plugin/plugins/windicss.md new file mode 100644 index 00000000..77992602 --- /dev/null +++ b/docs/reference/plugin/plugins/windicss.md @@ -0,0 +1,28 @@ +# @fesjs/plugin-windicss + + +## 介绍 + +`windicss` 支持 + +## 启用方式 +在 `package.json` 中引入依赖: +```json +{ + "devDependencies": { + "@fesjs/plugin-windicss": "^2.0.0" + }, +} +``` + +## 配置 + +在 `.fes.js` 配置文件中添加自定义配置,详细配置[请看](https://windicss.org/integrations/webpack.html): + +``` +{ + windicss: { + root: './', + } +} +``` diff --git a/docs/zh/reference/plugin/plugins/windicss.md b/docs/zh/reference/plugin/plugins/windicss.md new file mode 100644 index 00000000..be28d80b --- /dev/null +++ b/docs/zh/reference/plugin/plugins/windicss.md @@ -0,0 +1,28 @@ +# @fesjs/plugin-windicss + + +## 介绍 + +`windicss` 支持 + +## 启用方式 +在 `package.json` 中引入依赖: +```json +{ + "devDependencies": { + "@fesjs/plugin-windicss": "^2.0.0" + }, +} +``` + +## 配置 + +在 `.fes.js` 配置文件中添加自定义配置,详细配置[请看](https://windicss.org/integrations/webpack.html): + +```js +export default { + windicss: { + root: './', + } +} +``` diff --git a/packages/fes-plugin-windicss/src/index.js b/packages/fes-plugin-windicss/src/index.js index 733b0731..702a36bf 100644 --- a/packages/fes-plugin-windicss/src/index.js +++ b/packages/fes-plugin-windicss/src/index.js @@ -1,9 +1,11 @@ import WindiCSSWebpackPlugin from 'windicss-webpack-plugin'; +import { resolve } from 'path'; + export default (api) => { api.describe({ - key: 'windi', + key: 'windicss', config: { default: {} } @@ -12,7 +14,12 @@ export default (api) => { api.addEntryImportsAhead(() => [{ source: 'windi.css' }]); api.chainWebpack((memo) => { - memo.plugin('windicss').before('vue-loader-plugin').use(WindiCSSWebpackPlugin); + memo.plugin('windicss').before('vue-loader-plugin').use(WindiCSSWebpackPlugin, [ + { + config: resolve(__dirname, '../windi.config.js'), + ...api.config.windicss + } + ]); return memo; }); }; diff --git a/packages/fes-template/windi.config.js b/packages/fes-plugin-windicss/windi.config.js similarity index 100% rename from packages/fes-template/windi.config.js rename to packages/fes-plugin-windicss/windi.config.js diff --git a/packages/fes-template/src/pages/index.vue b/packages/fes-template/src/pages/index.vue index 1fb60d14..62907123 100644 --- a/packages/fes-template/src/pages/index.vue +++ b/packages/fes-template/src/pages/index.vue @@ -2,7 +2,7 @@
Primary -
国际化 {{t("test")}}
+
国际化 {{t("test")}}
fes & 拉夫德鲁
accessOnepicess1
accessOnepicess2
@@ -29,10 +29,7 @@ import { Button, Input } from 'ant-design-vue'; export default { components: { [Button.name]: Button, - [Input.name]: Input, - }, - mounted(){ - console.log("$style:", this.$style) + [Input.name]: Input }, setup() { const fes = ref('fes upgrade to vue3'); @@ -129,6 +126,9 @@ export default { enumsGet: enums.get, roles }; + }, + mounted() { + console.log('$style:', this.$style); } };