Open
Description
Update libsass.html — create resource from template with ExecuteAsTemplate
:
{{ $css := "" }}
{{ if eq (hugo.Environment) "development" -}}
{{ $options := (dict "targetPath" "main.css" "transpiler" "libsass" "enableSourceMap" true "includePaths" (slice "node_modules")) -}}
{{ $css = resources.Get . | resources.ExecuteAsTemplate "app.scss" . | toCSS $options | resources.Fingerprint "sha512" -}}
{{ else -}}
{{ $options := (dict "targetPath" "main.css" "transpiler" "libsass" "outputStyle" "compressed" "includePaths" (slice "node_modules")) -}}
{{ $css = resources.Get . | resources.ExecuteAsTemplate "app.scss" . | toCSS $options | postCSS (dict "config" "config/postcss.config.js") | resources.Fingerprint "sha512" -}}
{{ end -}}
<link rel="stylesheet" href="{{ $css.Permalink | relURL }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous">
Example
In config\_default\hyas\starter.toml
:
[..]
# SCSS
backGround = "yellowgreen"
In assets\scss\app.scss
:
[..]
body {
background-color: {{ site.Data.starter.backGround }};
}
[..]