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 384a728
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 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
12 changes: 3 additions & 9 deletions src/layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@

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

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

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

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

{{ 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 384a728

Please sign in to comment.