Skip to content

Instantly share code, notes, and snippets.

@jedfoster
Forked from scottkellum/SassMeister-input.scss
Created January 10, 2014 00:40
Show Gist options
  • Save jedfoster/8344899 to your computer and use it in GitHub Desktop.
Save jedfoster/8344899 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
// Using Sass 3.3 maps as a way to change
// the output of mixins.
// Loop through a map to write styles
@mixin map-styles($map) {
// Find properties and values in map
@each $p, $v in $map {
// Write property: value;
#{$p}: $v;
}
}
$default-styles:(
width: 50%,
color: white,
) !default;
@mixin foo($color, $styles: $default-styles) {
background-color: $color;
@include map-styles($styles);
}
// The user can change the output styles on the fly
// without having to re-engineer the original mixin.
$default-styles:(
width: 200px,
color: purple,
);
foo {
@include foo(red);
}
foo{background-color:red;width:200px;color:purple}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment