Debian Codegraph @

docs/content/en/functions/resources/Concat.md

raw
1 ---
2 title: resources.Concat
3 description: Returns a concatenated slice of resources.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: resource.Resource
10 signatures: ['resources.Concat TARGETPATH [RESOURCE...]']
11 ---
12
13 {{% include "/_common/methods/resource/global-page-remote-resources.md" %}}
14
15 The `resources.Concat` function returns a concatenated slice of resources, caching the result using the target path as its cache key. Each resource must have the same [media type](g).
16
17 Hugo publishes the resource to the target path when you call its [`Publish`][], [`Permalink`][], or [`RelPermalink`][] method.
18
19 ```go-html-template
20 {{ $plugins := resources.Get "js/plugins.js" }}
21 {{ $global := resources.Get "js/global.js" }}
22 {{ $js := slice $plugins $global | resources.Concat "js/bundle.js" }}
23 ```
24
25 [`Permalink`]: /methods/resource/permalink/
26 [`Publish`]: /methods/resource/publish/
27 [`RelPermalink`]: /methods/resource/relpermalink/