Hi all! I am loving the JS build / bundling support; it makes it so easy to modify JS in themes, because you don’t need to go through the rigmarole of installing a full JS toolchain
I have one question to this feature – are the assets produced by calls to js.Build
cached?
To make the question more concrete, I have a partial named head_includes.html
:
{{ $opts := dict "targetPath" "js/main.js" "minify" true "target" "es2015" }}
{{ $mainJs := resources.Get "js/main.js" | js.Build $opts }}
<script type="text/javascript" src="{{ $mainJs.RelPermalink }}" defer></script>
This is included on every page on the site, and I wanted to make sure that the JS build is only running once per site build, rather than once per page.
Some limited profiling (with hugo --templateMetrics
) and swapping between including this partial with both partial
and partialCached
results in no difference in build performance, which seems to suggest that the js.Build
is cached, but I wanted to check