Ajdegar
December 10, 2025, 9:31am
1
this minification not working. There is no error, just file is not minified.
{{ $jscode := resources.Get "js/libs.min.js" -}}
{{ $jscode2 := resources.Get "js/app.js" | minify -}}
{{ $jsb := slice $jscode $jscode2 | resources.Concat "js/default.js" -}}
<script src="{{ $jsb.RelPermalink }}" defer crossorigin="anonymous"></script>
Concat the resources, then minify. Do not minify one resource and concat with a non-minified one:
From the docs (which should really be your first point of reference):
{{ $js := slice $jscode $jscode2 | resources.Concat "js/bundle.js" | resources.Minify }}
Or use the --minify flag when building the site. There’s little sense in minification during development, imo.
Ajdegar
December 10, 2025, 10:41am
3
one of the files is minified already. I don’t think so minifing js file twice is a good idea.
irkode
December 10, 2025, 11:46am
5
i wouldn’t care about minifying twice…just some ms.
whats your config for minify?
and the libs + apps points me to a recent issue…JS Build with concat
but maybe just file is not minified. needs some more details
{{ $mainMin := resources.Get "js/main.min.js" }}
{{ $hljs := resources.Get "js/highlight.js" | minify }}
{{ $jsb := slice $mainMin $hljs | resources.Concat "js/mixed.js"}}
<script src="{{ $jsb.RelPermalink }}"></script>
The result looks minified to me.