From 5beef07281b367d4dd80b975eca1bf348ae223e8 Mon Sep 17 00:00:00 2001 From: bac-joker Date: Fri, 25 Dec 2020 20:49:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9B=91=E5=90=ACicons=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E5=8F=98=E6=9B=B4=EF=BC=8C=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-icon/src/icons.tpl | 4 ++-- packages/fes-plugin-icon/src/index.js | 4 +++- packages/fes-preset-built-in/src/utils/generateFiles.js | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/fes-plugin-icon/src/icons.tpl b/packages/fes-plugin-icon/src/icons.tpl index 9bb58afb..178eb7bf 100644 --- a/packages/fes-plugin-icon/src/icons.tpl +++ b/packages/fes-plugin-icon/src/icons.tpl @@ -1,9 +1,9 @@ {{#ICON_NAMES}} -import smile from './icons/{{.}}'; +import {{.}} from './icons/{{.}}'; {{/ICON_NAMES}} export default { {{#ICON_NAMES}} - {{.}} + {{.}}, {{/ICON_NAMES}} }; \ No newline at end of file diff --git a/packages/fes-plugin-icon/src/index.js b/packages/fes-plugin-icon/src/index.js index 9b7819ce..a320e45a 100644 --- a/packages/fes-plugin-icon/src/index.js +++ b/packages/fes-plugin-icon/src/index.js @@ -17,7 +17,9 @@ export default (api) => { const namespace = 'plugin-icon'; const absRuntimeFilePath = join(namespace, 'runtime.js'); - // TODO 监听 icons 文件变更,重新生成文件 + // 监听 icons 文件变更,重新生成文件 + api.addTmpGenerateWatcherPaths(() => join(api.paths.absSrcPath, 'icons')); + api.onGenerateFiles(async () => { const base = join(api.paths.absSrcPath, 'icons'); const iconFiles = api.utils.glob.sync('**/*', { diff --git a/packages/fes-preset-built-in/src/utils/generateFiles.js b/packages/fes-preset-built-in/src/utils/generateFiles.js index 3fd40cae..532e6255 100644 --- a/packages/fes-preset-built-in/src/utils/generateFiles.js +++ b/packages/fes-preset-built-in/src/utils/generateFiles.js @@ -32,7 +32,7 @@ export default async ({ api, watch }) => { 'all', lodash.throttle(async () => { await generate(); - }, 100), + }, 100) ); }