Skip to content

Commit

Permalink
Revert "Minify files on production (#429)"
Browse files Browse the repository at this point in the history
We'll revisit later
  • Loading branch information
XhmikosR committed Mar 20, 2024
1 parent ba80cbc commit 8578a4f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"scripts": {
"start": "npm run serve",
"build": "hugo --cleanDestinationDir --minify --printPathWarnings --printUnusedTemplates",
"build": "hugo --cleanDestinationDir --printPathWarnings --printUnusedTemplates",
"serve": "hugo server --port 4000 --disableFastRender --noHTTPCache --renderToMemory --printPathWarnings --printUnusedTemplates",
"serve-only": "npx sirv-cli _site --port 4000",
"test": "npm-run-all build --parallel --continue-on-error --aggregate-output test-*",
Expand Down
17 changes: 5 additions & 12 deletions src/layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@
{{- $bootstrapJs := resources.Get "/js/vendor/bootstrap.bundle.min.js" | fingerprint | resources.Copy "/assets/js/vendor/bootstrap.bundle.min.js" -}}
<script defer src="{{ $bootstrapJs.RelPermalink }}"></script>

{{- $scripts := slice "js/application.js" "js/lazyload.js" -}}
{{- range $scriptFile := $scripts -}}
{{- $script := resources.Get $scriptFile | js.Build $esbuildOptions -}}
{{- $application := resources.Get "js/application.js" | js.Build $esbuildOptions | fingerprint | resources.Copy "/assets/js/application.js" -}}
{{- $lazyload := resources.Get "js/lazyload.js" | js.Build $esbuildOptions | fingerprint | resources.Copy "/assets/js/lazyload.js" -}}

{{- if hugo.IsProduction -}}
{{- $script = $script | resources.Minify -}}
{{- end -}}

{{- $script = $script | fingerprint | resources.Copy (path.Join "/assets" $scriptFile) -}}

<script defer src="{{ $script.RelPermalink }}"></script>
{{- end -}}
<script defer src="{{ $application.RelPermalink }}"></script>
<script defer src="{{ $lazyload.RelPermalink }}"></script>

{{ range .Page.Params.extra_js -}}
<script{{ with .async }} async{{ end }}{{ with .defer }} defer{{ end }} src="{{ .src }}"{{ with .integrity }} {{ printf "integrity=%q" . | safeHTMLAttr }} crossorigin="anonymous"{{ end }}></script>
<script{{ with .async }} async{{ end }}{{ with .defer }} defer{{ end }} src="{{ .src }}"{{ with .integrity }} {{ printf "integrity=%q" . | safeHTMLAttr }} crossorigin="anonymous"{{ end }}></script>
{{- end -}}
6 changes: 1 addition & 5 deletions src/layouts/partials/stylesheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}

{{- $style := resources.Get "scss/style.scss" | toCSS $sassOptions | postCSS $postcssOptions -}}
{{- if hugo.IsProduction -}}
{{- $style = $style | resources.Minify -}}
{{- end -}}
{{- $style = $style | fingerprint -}}
{{- $style := resources.Get "scss/style.scss" | toCSS $sassOptions | postCSS $postcssOptions | fingerprint -}}

<link href="{{ $style.RelPermalink }}" rel="stylesheet">

0 comments on commit 8578a4f

Please sign in to comment.