build: 稳定文件名去hash + HTML压缩 + deploy脚本

- vite.config.js: 文件名去掉 [hash],输出到项目本地 dist/(emptyOutDir=true
  避免旧 hash 残留堆积);新增 html-minifier-terser 插件压缩 index.html。
- package.json: 新增 deploy 脚本,build 后用 rsync 把 dist/ 的 mainPage
  命名空间子目录同步到 Apache 站点根 /root/html,--delete 仅作用于 mainPage
  子目录,不误伤既有旧文件(jquery/pdf.js 等)。
- 站点始终由 Apache 静态服务(DocumentRoot /var/www/html),无 Node 实时渲染。
This commit is contained in:
Zikai
2026-07-24 09:34:22 +00:00
parent cb50c23c84
commit 1379e1a607
3 changed files with 276 additions and 20 deletions

View File

@@ -7,7 +7,8 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"deploy": "vite build && rsync -a --delete dist/js/mainPage/ /root/html/js/mainPage/ && rsync -a --delete dist/css/mainPage/ /root/html/css/mainPage/ && rsync -a dist/index.html /root/html/index.html && rsync -a dist/favicon.svg /root/html/favicon.svg"
},
"dependencies": {
"ical.js": "^2.1.0",
@@ -17,6 +18,7 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"html-minifier-terser": "^7.2.0",
"vite": "^5.2.0"
}
}