materialize icon indicating copy to clipboard operation
materialize copied to clipboard

Variables that use other variables

Open bobrocke opened this issue 11 years ago • 2 comments

There are several cases in the .scss version of the framework in which one variable uses another. This makes a lot of sense for consistency and maintainability, but it's impossible to override the first variable in an external file and effect the second.

One place is in the _variables.scss file itself. There is this:

$primary-color: color("materialize-red", "lighten-2") !default;
$primary-color-light: lighten($primary-color, 15%) !default;
$primary-color-dark: darken($primary-color, 15%) !default;

It make perfect sense to lighten or darken the primary color. But if I override $primary-color in my _local-variables.scss file (called after _variables.scss, but before the components), my change doesn't effect $primary-color-light nor $primary-color-dark.

bobrocke avatar May 03 '15 12:05 bobrocke

variable overrides should appear before the _variables.scss file. The !default allows them to be overriden by a previous declaration

Dogfalo avatar May 06 '15 16:05 Dogfalo

This makes little sense. In our project materialize is installed via npm. So i'm not going to edit the library files directly. And now, in my scss file that imports the materialize.scss at the top, I can only override variable that are not using other variables.

gitdistill avatar Aug 30 '16 20:08 gitdistill