mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-18 12:54:56 -04:00
Update introduction.md
This commit is contained in:
parent
1eb66c758b
commit
4bc4821521
@ -18,22 +18,22 @@ toc: true
|
||||
aliases: [/assets/]
|
||||
---
|
||||
|
||||
## Get Resource with resources.Get
|
||||
## Get Resource with resources.Get andresources.GetRemote
|
||||
|
||||
In order to process an asset with Hugo Pipes, it must be retrieved as a `Resource` using `resources.Get`. The first argument can be either a local the path to file relative to the `asset` directory/directories or a remote URL.
|
||||
|
||||
```go-html-template
|
||||
{{ $local := resources.Get "sass/main.scss" }}
|
||||
{{ $remote := resources.Get "https://www.example.com/styles.scss" }}
|
||||
{{ $remote := resources.GetRemote "https://www.example.com/styles.scss" }}
|
||||
```
|
||||
|
||||
`resources.Get` will always return `nil` if the resource could not be found.
|
||||
`resources.Get` and `resources.GetRemote` will always return `nil` if the resource could not be found.
|
||||
|
||||
### Error Handling
|
||||
|
||||
{{< new-in "0.90.1" >}}
|
||||
{{< new-in "0.91.0" >}}
|
||||
|
||||
The return value from `resources.Get` includes an `.Err` method that will return an error if the call failed. If you want to just log any error as a `WARNING` you can use a construct similar to the one below.
|
||||
The return value from `resources.GetRemote` includes an `.Err` method that will return an error if the call failed. If you want to just log any error as a `WARNING` you can use a construct similar to the one below.
|
||||
|
||||
```go-html-template
|
||||
{{ with resources.Get "https://gohugo.io/images/gohugoio-card-1.png" }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user