Style-dictionary: Add mixin format for scss variables

Created on 28 Nov 2019  路  1Comment  路  Source: amzn/style-dictionary

Normally we would use scss variables format to get the output in the following way. One of the example could be like below:

FileName: button-light.scss
$component-button-primary-background-color: #2b3e4b;

Lets imagine if we had to support for multiple themes we would have multiple files of scss variables. Dynamically importing scss variables based on theme is still not possible or not a straight way of doing it.

If Style-dictionary outputs like below:

@mixin button-light {
$component-button-primary-background-color: #2b3e4b;
}

we could then at the application side perform below:
:host-context(.light) {
@include button-light;
}

Could you please help me in creating a new formatter specially in my case. I would also think people would also benefit from this?

Most helpful comment

It was so easy to solve it myself. In love with style-dictionary :)

image

image

>All comments

It was so easy to solve it myself. In love with style-dictionary :)

image

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matt-tyas picture matt-tyas  路  3Comments

blackfalcon picture blackfalcon  路  4Comments

limitlessloop picture limitlessloop  路  4Comments

nategreen picture nategreen  路  5Comments

valiksb picture valiksb  路  4Comments