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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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