Config variables in sass files

is there a way to use variables defined in the site’s config.toml inside sass/scss files? i would like a theme to expose points of configuration like link color, and it seems the way to do that is with inline CSS in template html files to declare CSS variables, and ideally i could avoid inline CSS.

It’s not possible.

thanks. would the project entertain a proposal to make this possible?

If we can avoid templating the whole folder and pass things through Sass (if it exists) that would be great

i was thinking templating the whole sass folder would be messy. what if we were to inject sass variable definitions for the stuff set in config, as if they were implicitly defined at the top of the sass files? then the user could reference those variables as if they had written them themselves.

from some quick research, it looks like sass variables support maps and even support complex maps. so we could inject a single $config variable, similar to how config can be referenced from templates.

Yes that would be ideal (although not the full config object, probably just a subset)

i can draft a PR for comment. what subset of the config do you think would be appropriate to include? it’s probably just as easy to include the entire config document.

it’s probably just as easy to include the entire config document.

Yes but when you rename/remove fields it became a breaking change :wink:

I’m thinking base_url and all of extra of the default language?

Opened a PR below. Probably could use some cleanup, and definitely could use some doc updates, but wanted to at least see if this is something the maintainers would take into the project first.

This would be great. Right now I have to inline css from a macro, then feed that macro’s string (with evaluated vars) into get_hash() to push the result into CSP’s tag.