Sass in the Real World: book 2 of 4

Working with maps

The maps data type that was released in Sass 3.3 is an improvement to the existing lists data type. The map data type allows for:

  • Key/Value data sets
  • Unique list of keys
  • Access to the keys and values
  • Ability to iterate through these values

Along with this data type, Sass has also included some map functions (which we will be covering in functions: what's in the box) section:

  • map-get($map, $key)
  • map-merge($map1, $map2)
  • map-remove($map, $key)
  • map-keys($map)
  • map-values($map)
  • map-has-key(|$map, $key)
  • keywords($args)

Let's take a closer look at how we can use maps by further expanding on the font-awesome example.