Debian Codegraph @

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

raw
1 ---
2 title: resources.Publish
3 description: Returns the given resource after publishing it.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: resource.Resource
10 signatures: [resources.Publish RESOURCE]
11 ---
12
13 {{< new-in 0.166.0 />}}
14
15 {{% include "/_common/methods/resource/global-page-remote-resources.md" %}}
16
17 The `resources.Publish` function writes the given resource to the [`publishDir`][] and returns the resource, making it useful within a template pipeline.
18
19 ```go-html-template
20 {{ resources.Get "main.js" | js.Build | resources.Publish }}
21 ```
22
23 This is equivalent to:
24
25 ```go-html-template
26 {{ (resources.Get "main.js" | js.Build).Publish }}
27 ```
28
29 See the [`Publish`][] method for the non-pipeline form.
30
31 [`Publish`]: /methods/resource/publish/
32 [`publishDir`]: /configuration/all/#publishdir