Tuesday, March 17, 2015

5 Great Uses for Sass Maps

The Sass map is an awesome tool for organizing your code, minimizing duplication, and making your code base less prone to overall careless errors. They allow us to outline and document our projects in a way that helps with their overall architecture. Maps first came about in Sass 3.3, and have transformed the way developers structure their code. Last year, Hugo wrote a great post about using Sass maps, that I would recommend you also take a look at.


Please note that a Sass *sourcemap** is not the same thing as a Sass map. Both of these features came out in the same release, and are sometimes confused for each other.*


Basic Usage


Maps are surrounded by parenthesis () and are structured in key: value pairs. They are accessed with map-get() and can be nested within each other, allowing for organization of grouped content.


[code language="sass"] $map-name: ( key-1: val-1, key-2: val-2, key-3: val-3 ); [/code]

So now that we understand the basic structure, let's dive into five practical strategies for organizing our code that take advantage of maps!


Continue reading %5 Great Uses for Sass Maps%




by Una Kravets via SitePoint

No comments:

Post a Comment