diff --git a/content/en/functions/js/Batch.md b/content/en/functions/js/Batch.md index 85538c29b..9960faa39 100644 --- a/content/en/functions/js/Batch.md +++ b/content/en/functions/js/Batch.md @@ -256,6 +256,12 @@ Eeach [`Resource`] will be of media type `application/javascript` or `text/css`. In a template you would typically handle one group with a given `ID` (e.g. scripts for the current section). Because of the concurrent build, this needs to be done in a [`templates.Defer`] block: +{{% note %}} +The [`templates.Defer`] acts as a synchronisation point to handle scripts added concurrently by different templates. If you have a setup with where the batch is created in one go (in one template), you don't need it. + +See [this discussion] for more. +{{% /note %}} + ```go-html-template {{ $group := .group }} {{ with (templates.Defer (dict "key" $group "data" $group )) }} @@ -320,4 +326,4 @@ console.log('entrypoints-workaround.js'); [script options]: #script-options [script]: #script [SetOptions]: #optionssetter -[with]: https://gohugo.io/functions/go-template/with/ \ No newline at end of file +[with]: https://gohugo.io/functions/go-template/with/