Skip to content

Instantly share code, notes, and snippets.

@jackw
Created January 28, 2015 09:48
Show Gist options
  • Save jackw/c8dab1dde327a4acf88f to your computer and use it in GitHub Desktop.
Save jackw/c8dab1dde327a4acf88f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.1.0-beta)
// ----
// A basic mixin example...
@mixin my-mixin ($selector: '.container', $has-something: true, $bg-color: #fff) {
#{$selector} {
@if ($has-something) {
background: $bg-color;
} @else {
background: #c30c30;
}
}
}
// standard include
.selector {
@include my-mixin();
}
// overriding $selector in my-mixin
.another-selector {
@include my-mixin('.my-container');
}
// defining a map to pass into my-mixin
.yet-another-selector {
$params : (
'has-something': false,
'selector': '.my-other-container'
);
@include my-mixin($params...);
}
.selector .container {
background: #fff; }
.another-selector .my-container {
background: #fff; }
.yet-another-selector .my-other-container {
background: #c30c30; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment