27 | Using Maps for Namespace Configuration |
As your knowledge of Sass grows, you might want to create your own framework or design system for your team, your company, or maybe even all the web developers out there! A lot of the functions covered in this part would help with that. In particular, maps can help keep a framework from interfering with others’ code.
Say you have a color palette you use in your framework. You could define global variables, such as $red: #B23C56. But if a user has the same color variable, yours will be overwritten! Not good.
Instead, create a map called, say, $framework-colors. Then, when using the framework colors in your framework, just use the map-get() function.
This may seem like a lot of work, but as you can see ...
Get Pragmatic Guide to Sass 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.