26Manipulating Maps

As with lists, there are a few ways to edit maps on the fly. The main two functions are map-merge($map1, $map2) and map-remove($map, $keys…). Their names are pretty indicative of what they do, but you’ll learn about them more here.

map-merge() merges two maps together. Pretty simple, right? In the example, two $social maps are being merged together. This is useful for keeping maps separate in most cases, but needing them to be together for a few occasions. In the example, there’s a core set of social colors for the main social brands on the site. However, for icons, all the social colors, including some secondary social colors, need to be used. Therefore, map-merge() is used to merge the two maps into one larger map ...

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.