make stats optional and ignored by jekyll

This commit is contained in:
Miao Wang 2024-04-09 15:13:33 +08:00
parent 2115269686
commit 5ef1cad7c3
4 changed files with 45 additions and 314 deletions

2
.gitignore vendored
View File

@ -16,5 +16,5 @@
.DS_Store
/node_modules/
/.jekyll-cache/
stats.html
_stats.html

View File

@ -6,7 +6,14 @@ import components from 'unplugin-vue-components/vite'
import legacy from '@vitejs/plugin-legacy'
import { toSass } from 'sass-cast'
import { Liquid, Tag as LiquidTag } from 'liquidjs'
import { visualizer } from 'rollup-plugin-visualizer';
const visualizer = await (async()=>{
if (process.env.VISUALIZER) {
return (await import('rollup-plugin-visualizer')).visualizer;
}else{
return (()=>null);
}
})();
const exposedData = ['config', 'data', 'categories'];
const jekyllData = Object.fromEntries(exposedData.map((key) => [key, JSON.parse(process.env[`site_${key}`] || '{}')]));
@ -101,7 +108,9 @@ export default defineConfig(({mode})=>({
legacy({
targets: [],
}),
visualizer(),
visualizer({
filename: '_stats.html',
}),
],
css: {
preprocessorOptions: {

336
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
"scripts": {
"format": "prettier --write \"_src/**/*.js\" \"_src/**/*.vue\""
},
"devDependencies": {
"dependencies": {
"@vitejs/plugin-legacy": "^5.3.2",
"@vitejs/plugin-vue": "^5.0.4",
"bootstrap": "^5.3.3",
@ -13,8 +13,6 @@
"liquidjs": "^10.10.2",
"markup-js": "^1.5.21",
"mustache": "^4.2.0",
"prettier": "^3.2.5",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.74.1",
"sass-cast": "^0.5.6",
"terser": "^5.30.3",
@ -22,5 +20,9 @@
"unplugin-vue-components": "^0.26.0",
"vite": "^5.2.8",
"vite-plugin-ruby": "^5.0.0"
},
"devDependencies": {
"prettier": "^3.2.5",
"rollup-plugin-visualizer": "^5.12.0"
}
}