5 Great Uses for Sass Maps

Originally published at: http://www.sitepoint.com/5-great-uses-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.

$map-name: (
  key-1: val-1,
  key-2: val-2,
  key-3: val-3
);

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 this article on SitePoint

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.