Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Created May 30, 2012 16:30
Show Gist options
  • Select an option

  • Save rogeruiz/2837455 to your computer and use it in GitHub Desktop.

Select an option

Save rogeruiz/2837455 to your computer and use it in GitHub Desktop.
Mixins Versus Extends
.container {
width: 100px;
}
%inner {
font-family: Arial;
}
$fox-types: red, blue, green;
.container {
> .fox-red {
background-color: red;
@extend %inner;
}
}
/* ============================== */
/* ============================== */
/* ============================== */
@mixin container() {
font-family: Arial;
}
$fox-types: red, blue, green;
.container {
> .fox-green {
background-color: green;
@include container;
}
}
/* ============================== */
/* ============================== */
/* ============================== */
.container {
> .fox-green {
background-color: green;
@extend %inner;
}
}
/* ============================== */
/* ============================== */
/* ============================== */
.container {
> .fox-blue {
background-color: blue;
@include container;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment