Last active
January 28, 2016 19:15
-
-
Save lunelson/03f98ea0f172160a4e25 to your computer and use it in GitHub Desktop.
sketches for modular margin revival, sass-alpha
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 (v4.0.0.alpha.1) | |
// ---- | |
@mixin foo($opts: null, $bar: 1, $baz: 2, $bif: 3) { | |
@if $opts { @include foo($opts...); } @else { | |
bar: $bar; | |
baz: $baz; | |
bif: $bif; | |
} | |
} | |
.test { | |
@include foo((bar: 5, bif: 1)); | |
} | |
$sizes: (s1: mod-map(2), s2: mod-map(1.5)); | |
// mod-map(x) | |
// -> (a: mult, b: mult, c: mult) | |
/* | |
ADAPT margin-*() functions: | |
margin-y(unit) -> unit | |
margin-y(str) -> m value -> mult|map | |
margin-y(mult) -> rem value | |
margin-y(map) -> mult for current medium -> rem value | |
ADAPT setup, if using modular values: | |
@include media((for: margin-y)) { | |
@each $key, $value in $margins { | |
$n: str-slice($key, 2); | |
.mt#{$n} { margin-top: margin-y($value); } | |
.mb#{$n} { margin-bottom: margin-y($value); } | |
} | |
} | |
@else just this: | |
@each $key, $value in $margins { | |
$n: str-slice($key, 2); | |
.mt#{$n} { margin-top: margin-y($value); } | |
.mb#{$n} { margin-bottom: margin-y($value); } | |
} | |
*/ | |
@each $index, $value in $sizes { | |
.test { out: 'trim' + str-slice($index, 2); } | |
} |
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
Undefined variable: "$n". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment