Merge commit 'efa74c5c6e6ff1daddeb5834ea7c69bed2acf171'

This commit is contained in:
Bjørn Erik Pedersen
2020-06-16 14:19:31 +02:00
74 changed files with 112 additions and 156 deletions

View File

@@ -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" }}
```
```

View File

@@ -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`.

View File

@@ -14,7 +14,7 @@ weight: 01
sections_weight: 01
draft: false
aliases: [/assets/]
---
---
### Asset directory

View File

@@ -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

View File

@@ -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 }}