diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d817491..acc95703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,7 +45,7 @@ All notable changes to this project will be documented in this file. - :lipstick: Style: change line-break style of code element from `anywhere` to `auto` - :globe_with_meridians: Docs(i18n): update pt-br, de in i18n - :mag: Perf(SEO): enhance SEO performance -- :wrench: Chore: modify babel config and optimize theme.js compilation and loading +- :wrench: Chore: modify babel config and optimize theme.js compilation and loading (revert [`65371a1`](https://github.com/hugo-fixit/FixIt/commit/65371a19a40591c3f403f7fde2b7001c3390354d)) - :wrench: Chore: creating new go.mod: module github.com/hugo-fixit/FixIt - :arrow_up: Chore(libs): - Update simple-icons from 6.3.0 to 7.12.0 diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index bda655e8..175c4b8b 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -232,9 +232,7 @@ {{- /* PWA */ -}} {{- if .Site.Params.enablePWA | and hugo.IsProduction -}} - {{- $options := dict -}} - {{- $options = dict "targetPath" "service-worker.min.js" | merge $options -}} - {{- $options = dict "minify" true | merge $options -}} + {{- $options := dict "targetPath" "service-worker.min.js" "minify" true -}} {{- $source := resources.Get "js/service-worker.js" | js.Build $options -}} {{- $_ := $source.RelPermalink -}} {{- $config = dict "enablePWA" .Site.Params.enablePWA | merge $config -}} @@ -264,12 +262,14 @@ {{- $config | jsonify | printf "window.config=%s;" | dict "Content" | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- /* Theme script */ -}} +{{- /* TODO migrate to js.build in hugo future version */ -}} {{- dict "Source" "js/theme.min.js" "Fingerprint" $fingerprint "Defer" true | dict "Scratch" .Scratch "Data" | partial "scratch/script.html" -}} {{- $_ := (resources.Get "js/theme.min.js.map").RelPermalink -}} {{- /* Custom script */ -}} {{- with ((resources.Get "js/custom.js") | default (resources.Get "js/_custom.js")) -}} - {{- dict "Source" . "Minify" hugo.IsProduction "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} + {{- $options := dict "targetPath" "js/custom.min.js" "minify" true "sourceMap" "inline" -}} + {{- dict "Source" . "Build" $options "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}} {{- end -}} {{- with (.Scratch.Get "this").scriptArr -}} diff --git a/layouts/partials/plugin/script.html b/layouts/partials/plugin/script.html index 172de517..8a1e5afe 100644 --- a/layouts/partials/plugin/script.html +++ b/layouts/partials/plugin/script.html @@ -18,6 +18,9 @@ {{- $resource = $resource | fingerprint . -}} {{- $integrity = $resource.Data.Integrity -}} {{- end -}} + {{- with .Build -}} + {{- $resource = $resource | js.Build . -}} + {{- end -}} {{- $src = $resource.RelPermalink -}} {{- end -}} {{- $attrs := printf `src="%v"` $src -}}