mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
Merge commit 'efa74c5c6e6ff1daddeb5834ea7c69bed2acf171'
This commit is contained in:
@@ -15,12 +15,10 @@ sections_weight: 60
|
||||
draft: false
|
||||
---
|
||||
|
||||
|
||||
Asset files of the same MIME type can be bundled into one resource using `resources.Concat` which takes two arguments, a target path and a slice of resource objects.
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ $plugins := resources.Get "js/plugins.js" }}
|
||||
{{ $global := resources.Get "js/global.js" }}
|
||||
{{ $js := slice $plugins $global | resources.Concat "js/bundle.js" }}
|
||||
```
|
||||
```
|
||||
|
@@ -16,7 +16,7 @@ draft: false
|
||||
---
|
||||
|
||||
|
||||
Fingerprinting and [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) can be applied to any asset file using `resources.Fingerprint` which takes two arguments, the resource object and a [hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function).
|
||||
Fingerprinting and [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) can be applied to any asset file using `resources.Fingerprint` which takes two arguments, the resource object and a [hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function).
|
||||
|
||||
The default hash function is `sha256`. Other available functions are `sha384` (from Hugo `0.55`), `sha512` and `md5`.
|
||||
|
||||
|
@@ -14,7 +14,7 @@ weight: 01
|
||||
sections_weight: 01
|
||||
draft: false
|
||||
aliases: [/assets/]
|
||||
---
|
||||
---
|
||||
|
||||
### Asset directory
|
||||
|
||||
|
@@ -16,7 +16,7 @@ draft: false
|
||||
---
|
||||
|
||||
|
||||
Any resource of the aforementioned types can be minifed using `resources.Minify` which takes for argument the resource object.
|
||||
Any resource of the aforementioned types can be minified using `resources.Minify` which takes for argument the resource object.
|
||||
|
||||
|
||||
```go-html-template
|
||||
|
@@ -20,7 +20,7 @@ There are currently two limitations to this:
|
||||
|
||||
1. This only works in `*.html` templates (i.e. templates that produces HTML files).
|
||||
2. You cannot manipulate the values returned from the resource's methods. E.g. the `upper` in this example will not work as expected:
|
||||
|
||||
|
||||
```go-html-template
|
||||
{{ $css := resources.Get "css/main.css" }}
|
||||
{{ $css = $css | resources.PostCSS | minify | fingerprint | resources.PostProcess }}
|
||||
|
Reference in New Issue
Block a user