mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-08 03:15:22 -04:00
Update Batch.md
This commit is contained in:
parent
eb841ce66a
commit
15a8b1de61
@ -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/
|
||||
[with]: https://gohugo.io/functions/go-template/with/
|
||||
|
Loading…
x
Reference in New Issue
Block a user