Skip to content

Instantly share code, notes, and snippets.

@hagenburger
Created May 13, 2011 17:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hagenburger/970906 to your computer and use it in GitHub Desktop.
Save hagenburger/970906 to your computer and use it in GitHub Desktop.
Some idea how compass could use @extend instead of mixins with backward compatibility
$exend-compass-mixins: true;
.my-box {
background: red;
@include box-shadow(black, 0, 1px, 5px);
@include clearfix;
}
.my-other-box {
background: green;
@include box-shadow(red, 2px, 0, 10px);
@include clearfix;
}
@include extended-compass-mixins;
// this is just to clarify what happens between step 1 and 3; this file would not exist
.my-box {
background: red;
@extend .c1;
@extend .c2;
}
.my-other-box {
background: green;
@extend .c2;
@extend .c3;
}
.c1 {
@include box-shadow(black, 0, 1px, 5px);
}
.c2 {
@include clearfix;
}
.c3 {
@include box-shadow(red, 2px, 0, 10px);
}
.my-box {
background: red;
}
.my-other-box {
background: green;
}
.c1, .my-box {
-moz-box-shadow: black 0 1px 5px 0;
-webkit-box-shadow: black 0 1px 5px 0;
-o-box-shadow: black 0 1px 5px 0;
box-shadow: black 0 1px 5px 0;
}
.c2, .my-box, .my-other-box {
overflow: hidden;
*zoom: 1;
}
.c3, .my-other-box {
-moz-box-shadow: red 2px 0 10px 0;
-webkit-box-shadow: red 2px 0 10px 0;
-o-box-shadow: red 2px 0 10px 0;
box-shadow: red 2px 0 10px 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment