DEV Community

Discussion on: Beginner's guide to SASS

Collapse
 
kittygiraudel profile image
Kitty Giraudel

Hey there!

That’s a nice introduction to the main features in Sass. I hope you don’t mind me giving a few tips as well:

  • In general, I’d recommend naming variables after their purpose rather than their content. This way, the variable usage explains intent, which is likely to be more relevant than the actual color, especially when scaling. More on the topic in sass-guidelin.es/#colors-and-varia....

  • Be weary with selector nesting. It is an interesting and powerful feature but I feel like it has been advertised as a handy “write less do more” solution when it should have mostly been used by frameworks and libraries as an underlying tool to create complex systems. More on the topic in sass-guidelin.es/#selector-nesting.

  • On the topic of mixins, I think the only thing to pay attention to is not to create unnecessary or incorrect abstractions. It’s tempting to just create mixins for sets of declarations that go together, but one should consider whether they are grouped by intent or by coincidence. Only when things should always be grouped together should they be gathered in a mixin. more on the topic in: sass-guidelin.es/#mixins.

I hope this helps. :)

Collapse
 
akanksha_9560 profile image
Aks

you are right, many times we are tempted to write as many abstractions as possible,
but instead in SASS one should think about reusablitiy deeply. Because writing many mixins for everything might create more confusion for developer coming in to work after us.