Mark
Mark

Reputation: 1059

Can you override a sass variable twice, dependant on context?

I'm using the library Bulma for CSS. This comes with default sass variables that can be adjusted. Rather than change it globally I wish to change the value of one such variable to be in one context:

$table-cell-border: 0;

and in another

$table-cell-border: 1;

Is this possible? Do I need to override the underlying CSS instead?

Thanks!

Upvotes: 0

Views: 198

Answers (1)

Kunal Tanwar
Kunal Tanwar

Reputation: 1291

Yes you can achieve this see the example below

$primary-color: red;

body {
  background-color: $primary-color; // here red color will get applied.
}

.myClass {
  $primary-color green;
  background-color: $primary-color; // here the green color will get applied
}

You can override the value of variable inside a scope.

Upvotes: 1

Related Questions