0.0.6 • Published 7 years ago

map.sass v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

map.sass

Functions for Sass map.

Install

yarn add map.sass

Usage Example

Defining a color palettes

By using a map-access function like following my-color-palettes.scss.

@import '~map.sass/map-access.scss';
$color-palettes: (
  error: (
    fg: white,
    bg: red,
  ),
  anchor: (
    base: (
      normal: blue,
      hover: yellow,
    ),
  ),
);
@function my-palette($keys...) {
  @return map-access($palettes, $keys...);
}

map-get(map-get(map-get(...)...)...) is no longer necessary.

@import './my-color-palettes';
.warning-message {
  color: my-palette(error, fg);
  background-color: my-palette(error, bg);

  // you can also access to any nested map
  a { color: my-palette(anchor, base, normal); }
  a:hover { color: my-palette(anchor, base, hover); }
}
0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago