Skip to content

Instantly share code, notes, and snippets.

@rickharris
Created November 12, 2011 20:40
Show Gist options
  • Save rickharris/1361082 to your computer and use it in GitHub Desktop.
Save rickharris/1361082 to your computer and use it in GitHub Desktop.
Using Susy (http://susy.oddbird.net/) with @extend rather than @include
// Imports -------------------------------------------------------------------
@import "susy";
// Configuration -------------------------------------------------------------
$total-cols : 12;
$col-width : 4em;
$gutter-width : 1em;
$side-gutter-width : $gutter-width;
$show-grid-backgrounds : true;
/* Grid ------------------------------------------------------------------- */
.container {
@include container;
@if $show-grid-backgrounds {
@include susy-grid-background;
}
}
.column {
@include float(left);
}
@for $context from 1 through $total-cols {
/* Non-nested grids */
.grid-#{$context} {
@extend .column;
margin-right: gutter();
width: columns($context);
}
.prefix-#{$context} {
@include prefix($context);
}
.suffix-#{$context} {
@include suffix($context);
}
/* Nested grids */
.column-context-#{$context} {
@extend .column;
margin-right: gutter($context);
}
@for $cols from 1 through ($context - 1) {
.grid-#{$cols}-of-#{$context} {
@extend .column-context-#{$context};
width: columns($cols, $context);
}
.prefix-#{$cols}-of-#{$context} {
@include prefix($cols, $context);
}
.suffix-#{$cols}-of-#{$context} {
@include suffix($cols, $context);
}
}
}
.alpha {
@include alpha;
}
.omega {
@include omega;
}
.omega-nested {
@extend .omega;
margin-right: 0;
}
.full-nested {
@include full($nested: true);
}
.full {
@extend .full-nested;
margin: {
left: side-gutter();
right: side-gutter();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment