SCSS variable with config value

Hello,

Just a simple question about Hugo v0.43. It is possible to override a SCSS variable with a config value?

I was peeking at the SCSS demo and saw this. The release notes are not clear about this feature.

You should turn to resources.ExecuteAsTemplate, you’ll need some trivial an error, but this allows to load a resource file (like sass) with Go Template in it.

/* sass/main.scss */
$background: {{ .Site.Params.bg }};

And then…

{{ $sass := resources.Get "sass/main.scss" | resources.ExecuteAsTemplate "style.main.scss" . | toCSS }}

I don’t think you can have Go Template from inside a sass file imported using @import yet but I’m still investigating.

Please share your discoveries in the discourse so everyone can benefit :wink: