Assets and Pipes
There are two steps to configure the assets in Hugo.
1 Place the assets in the assets
folder.
For example, move the static/css
folder to assets/css
, now the folder will
look something like this:
2 Provide instractions of how to use the files in the template.
12
13
14
15
16
17
18
{{ "<!-- Main Stylesheet -->" | safeHTML }}
{{ $asciidoc_css := resources.Get "css/asciidoctor.css" }} (1)
{{ $theme_css := resources.Get "css/style-white.css" }} (1)
{{ $syntax_css := resources.Get "css/syntax.css" }} (1)
{{ $custom_css := resources.Get "css/style-white.css" }} (1)
{{ $style := slice $asciidoc_css $theme_css $syntax_css $custom_css | resources.Concat "css/style.css" }} (2)
<link rel="stylesheet" href="{{ $style.Permalink }}" media="screen"> (3)
1 | Get the resources into varibles |
2 | Use pipes (| ) to bundle the assets |
3 | Add link to the assets |
The minification can be accomplished by --minify argument when building
the site for production, this makes it easier to debug during development. |