Skip to content

Instantly share code, notes, and snippets.

@lunelson
Last active January 28, 2016 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunelson/03f98ea0f172160a4e25 to your computer and use it in GitHub Desktop.
Save lunelson/03f98ea0f172160a4e25 to your computer and use it in GitHub Desktop.
sketches for modular margin revival, sass-alpha
// ----
// 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); }
}
Undefined variable: "$n".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment