csstools/postcss-advanced-variables

Reset Variable Values

urstrulyKarthik opened this issue · 1 comments

I have the following css using advanced variables:

/* style.css */
$brandColor: #8C50FF;

.common {
color: $brandColor;
text-decoration: none;
}

Now I want to replace the brandColor value in my webpack config, based on the docs I tried:
vars({
variables: {
brandColor: '#3e00b6'
}
})

The actual value remains #8C50FF. If I remove the $brandColor: #8C50FF; entry, then the value is set.

It would be great to not require the variables to be present always and set a default one instead. Can we provide this behavior with an option? Let the default behavior continue but invert the behavior to do this through configuration? what do you think?

There is behavior for this. It is the !default option.

$default: "default-value" !default;

.test-default {
	content: $default;
}

https://github.com/jonathantneal/postcss-advanced-variables/blob/master/test/default.css