mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
refactor: unify bundled assets with subdirs and Hugo mounts
Move bundled outputs to dedicated css/js subdirs. Update Vite config to output directly to bundled/ with simplified naming. Add Hugo module mounts to expose as assets/bundled and static/bundled. Adjust gitignore and partial accordingly. Signed-off-by: Sped0n <hi@sped0n.com>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -27,4 +27,4 @@ jsconfig.json
|
||||
*.css.map
|
||||
|
||||
# dummmy file
|
||||
assets/bundled/critical.js
|
||||
bundled/css/critical.js
|
||||
|
||||
@@ -3,5 +3,4 @@ static/
|
||||
exmapleSite/
|
||||
single.json
|
||||
pnpm-lock.yaml
|
||||
assets/bundled/
|
||||
assets/bundled/
|
||||
bundled/
|
||||
|
||||
0
bundled/js/critical.js
Normal file
0
bundled/js/critical.js
Normal file
@@ -12,13 +12,7 @@ export default defineConfig([
|
||||
tseslint.configs.recommended,
|
||||
importPlugin.flatConfigs.recommended,
|
||||
solid,
|
||||
globalIgnores([
|
||||
'node_modules/',
|
||||
'static/',
|
||||
'exampleSite/',
|
||||
'*.mjs',
|
||||
'assets/bundled/'
|
||||
]),
|
||||
globalIgnores(['node_modules/', 'static/', 'exampleSite/', '*.mjs', 'bundled/']),
|
||||
{
|
||||
...love,
|
||||
...prettier,
|
||||
|
||||
18
hugo.toml
Normal file
18
hugo.toml
Normal file
@@ -0,0 +1,18 @@
|
||||
[[module.mounts]]
|
||||
source = 'archetypes'
|
||||
target = 'archetypes'
|
||||
[[module.mounts]]
|
||||
source = 'assets'
|
||||
target = 'assets'
|
||||
[[module.mounts]]
|
||||
source = 'layouts'
|
||||
target = 'layouts'
|
||||
[[module.mounts]]
|
||||
source = 'static'
|
||||
target = 'static'
|
||||
[[module.mounts]]
|
||||
source = "bundled"
|
||||
target = "assets/bundled"
|
||||
[[module.mounts]]
|
||||
source = "bundled"
|
||||
target = "static/bundled"
|
||||
@@ -2,7 +2,7 @@
|
||||
{{- $fingerprint := .Scratch.Get "fingerprint" | default "" -}}
|
||||
|
||||
{{- /* critical style */ -}}
|
||||
{{- $style := dict "Source" "bundled/critical.css" "Fingerprint" $fingerprint -}}
|
||||
{{- $style := dict "Source" "bundled/css/critical.css" "Fingerprint" $fingerprint -}}
|
||||
{{- $options := dict "enableSourceMap" false -}}
|
||||
{{- $style = dict "Context" . "ToCSS" $options "Inline" true "Template" true | merge $style -}}
|
||||
{{- partial "plugin/style.html" $style -}}
|
||||
|
||||
@@ -4,7 +4,7 @@ import solidPlugin from 'vite-plugin-solid'
|
||||
export default defineConfig({
|
||||
plugins: [solidPlugin()],
|
||||
build: {
|
||||
outDir: './',
|
||||
outDir: './bundled',
|
||||
watch: process.env.DISABLE_WATCH
|
||||
? null
|
||||
: {
|
||||
@@ -17,15 +17,9 @@ export default defineConfig({
|
||||
},
|
||||
output: {
|
||||
format: 'es',
|
||||
entryFileNames: (chunkInfo) =>
|
||||
chunkInfo.name === 'critical'
|
||||
? 'assets/bundled/[name].js'
|
||||
: 'static/bundled/js/[name].js',
|
||||
chunkFileNames: 'static/bundled/js/[hash:6].js',
|
||||
assetFileNames: (assetInfo) =>
|
||||
assetInfo.names[0]?.startsWith('critical')
|
||||
? 'assets/bundled/[name].[ext]'
|
||||
: 'static/bundled/[ext]/[name].[ext]',
|
||||
entryFileNames: 'js/[name].js',
|
||||
chunkFileNames: 'js/[hash:6].js',
|
||||
assetFileNames: '[ext]/[name].[ext]',
|
||||
compact: true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user