wtho / bulma-css-vars

Bulma with CSS Variables
https://wtho.github.io/bulma-css-vars
MIT License
60 stars 13 forks source link

Feature request - Add support for non-color variables #4

Open AcelisWeaven opened 4 years ago

AcelisWeaven commented 4 years ago

One feature I'd like to see would be the possibility to change other properties, like the font-family.

The ColorUpdater wouldn't be needed, and you could simply do something like this:

document.documentElement.style.setProperty('--body-family', 'OpenSans, sans-serif');

However, I don't know if it fits the project. What's your opinion about this?

-- Sorry for the quick edit. I figured you can already do this with Bulma only. To use it with this project, I did the following in my main scss file:

@import './generated/generated-bulma-fallback.css';
@import './generated/generated-bulma-vars.sass';

:root {
  --default-body-family: $body-family;
}

$body-family: var(--body-family, --default-body-family);

@import '../node_modules/bulma-css-vars/bulma-cv-lib.sass';
wtho commented 4 years ago

Yeah, for fonts there is no need to provide additional wrappers like it is for colors. I think it is clearer to set the css variables directly in your code.

I identified two more cases where computing derived variables requires extra work:

But I think it's worthwhile waiting until someone requires this feature.