| 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 |
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). |
| 14 |
|
| 15 |
Hugo publishes the resource to the target path when you call its [`Publish`][], [`Permalink`][], or [`RelPermalink`][] method. |
| 16 |
|
| 17 |
```go-html-template |
| 18 |
{{ $plugins := resources.Get "js/plugins.js" }} |
| 19 |
{{ $global := resources.Get "js/global.js" }} |
| 20 |
{{ $js := slice $plugins $global | resources.Concat "js/bundle.js" }} |
| 21 |
``` |
| 22 |
|
| 23 |
[`Permalink`]: /methods/resource/permalink/ |
| 24 |
[`Publish`]: /methods/resource/publish/ |
| 25 |
[`RelPermalink`]: /methods/resource/relpermalink/ |