Skip to content

Instantly share code, notes, and snippets.

@acdlite
Created November 4, 2013 20:40
Show Gist options
  • Save acdlite/7308879 to your computer and use it in GitHub Desktop.
Save acdlite/7308879 to your computer and use it in GitHub Desktop.
More experimenting using maps to organize Susy grids (or any other kind of data). Essentially, this is just abstracting calls to map-set() and map-merge to make the syntax more friendly. Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
$_grids: ();
@mixin add-grid($g, $name) {
$_grids: map-merge($_grids, ($name: $g));
}
@function grid($name) {
@return map-get($_grids, $name);
}
$grid-1: 90% 8 1/4;
$grid-2: 100% (4 8) 1/4;
@include add-grid($grid-1, 1); // Add grid-1
a { output: grid(1) }
b { output: grid(2) } // Will output nothing since it hasn't been added yet
@include add-grid($grid-2, 2); // Add grid-2
c { output: grid(2) } // Now it is output
a {
output: 90% 8 1/4;
}
c {
output: 100% 4 8 1/4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment