From 07ef47f649e2fd62dfe5062201b1915b4ab00f6b Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Mon, 20 Sep 2021 07:22:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhttp-server=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8Cvite=E7=9B=B8=E5=85=B3=E7=9B=B8=E5=85=B3=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E9=85=8D=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 + package.json | 6 +++--- vite/plugins/banner.js | 6 ++++-- vite/plugins/html.js | 12 +++++++++++- vite/plugins/restart.js | 11 ++++++++++- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 920da3be..dd0e4b14 100644 --- a/index.html +++ b/index.html @@ -83,6 +83,7 @@ margin-top: 20px; } + <%- copyrightScript %>
diff --git a/package.json b/package.json index 4334762f..b5ea7ff9 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "dev": "vite", "build:test": "vite build --mode test", "build": "vite build", - "serve:test": "hs ./dist-test -o", - "serve": "hs ./dist -o", - "serve:example": "hs ./dist-example -o", + "serve:test": "http-server ./dist-test -o", + "serve": "http-server ./dist -o", + "serve:example": "http-server ./dist-example -o", "svgo": "svgo -f src/assets/icons", "new": "plop", "lint:eslint": "eslint src/**/*.{js,vue} --fix", diff --git a/vite/plugins/banner.js b/vite/plugins/banner.js index af7d0f48..da55583b 100644 --- a/vite/plugins/banner.js +++ b/vite/plugins/banner.js @@ -3,8 +3,10 @@ import banner from 'vite-plugin-banner' export default function createBanner() { return banner(` /** - * name: Fantastic-admin - * homepage: https://hooray.gitee.io/fantastic-admin/ + * 由 Fantastic-admin 提供技术支持 + * https://hooray.gitee.io/fantastic-admin/ + * Powered by Fantastic-admin + * https://hooray.github.io/fantastic-admin/ */ `) } diff --git a/vite/plugins/html.js b/vite/plugins/html.js index 6b8114b8..14d96b02 100644 --- a/vite/plugins/html.js +++ b/vite/plugins/html.js @@ -1,5 +1,9 @@ import htmlPlugin from 'vite-plugin-html' +const copyright_common_style = 'font-size: 14px; margin-bottom: 2px; padding: 6px 8px; color: #fff;' +const copyright_main_style = `${copyright_common_style} background: #e24329;` +const copyright_sub_style = `${copyright_common_style} background: #707070;` + export default function createHtml(env, isBuild) { const { VITE_APP_TITLE, VITE_APP_DEBUG_TOOL, VITE_APP_MODE } = env const html = htmlPlugin({ @@ -7,7 +11,13 @@ export default function createHtml(env, isBuild) { injectData: { title: VITE_APP_TITLE, debugTool: VITE_APP_DEBUG_TOOL, - appMode: VITE_APP_MODE + appMode: VITE_APP_MODE, + copyrightScript: ` + + ` } }, minify: isBuild diff --git a/vite/plugins/restart.js b/vite/plugins/restart.js index eedc4a66..7b450224 100644 --- a/vite/plugins/restart.js +++ b/vite/plugins/restart.js @@ -4,7 +4,16 @@ export default function createRestart() { return ViteRestart({ restart: [ '.env.development', - 'vite/plugins/index.js' + 'vite/plugins/index.js', + 'vite/plugins/auto-import.js', + 'vite/plugins/banner.js', + 'vite/plugins/components.js', + 'vite/plugins/compression.js', + 'vite/plugins/html.js', + 'vite/plugins/mock.js', + 'vite/plugins/restart.js', + 'vite/plugins/spritesmith.js', + 'vite/plugins/svg-icon.js' ] }) }