Skip to content

Instantly share code, notes, and snippets.

@timeinfeldt
Created April 25, 2014 15:27
Show Gist options
  • Select an option

  • Save timeinfeldt/11293500 to your computer and use it in GitHub Desktop.

Select an option

Save timeinfeldt/11293500 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.5)
// Compass (v1.0.0.alpha.18)
// ----
$map:();
$values: (text-s 12px), (text-m 14px), (text-l 16px);
// generate classes from $values
@each $item in $values {
.#{nth($item, 1)} {
font-size: nth($item, 2);
}
}
// generate silent classes from $values
@each $item in $values {
%#{nth($item, 1)} {
font-size: nth($item, 2);
}
}
// fill map from $values
@each $item in $values {
$map: map-merge($map, (nth($item, 1): nth($item, 2)));
}
// use one of the generated silent classes
.using-extend {
@extend %text-l;
}
@function get($key) {
@return map-get($map, $key);
}
.using-map {
//font-size: map-get($map,text-l);
font-size: get(text-l);
}
.text-s {
font-size: 12px;
}
.text-m {
font-size: 14px;
}
.text-l {
font-size: 16px;
}
.using-extend {
font-size: 16px;
}
.using-map {
font-size: 16px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment