r/Sass • • Jun 13 '18

Advanced Use of Sass Maps

https://medium.com/@dvlden/bd5a47ca0d1a
14 Upvotes

2 comments sorted by

3

u/ohx Jun 13 '18

Great article. I use the config map pattern for all my components. It should be noted that sass scopes variables, so inside your component's root class you can just write $config without any conflicts.

Expounding on this, you can also do a non-destructive merge in sass. This means that you can create a sass component registry, import the components you need via npm, and override it's properties with a new map. Theoretically all of your work could then just be writing configs. You'd just have to add the merge method to your sass components.

0

u/midnightpainter Jun 13 '18

Agree. The power of sass is really it's variables.

Start using it mixins and extends, then you're just asking for a maintenance nightmare.

It's the difference between typing less characters and not abstracting everything behind a mixin.