Created
April 21, 2017 12:06
-
-
Save seven-phases-max/bf4c8ce5a3159af9eb5b82f48e554791 to your computer and use it in GitHub Desktop.
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
test { | |
left-etc { | |
.FluidGutter(margin, 1, 2, 3, 4); | |
} | |
vert-horz { | |
.FluidGutter(padding, @v: 22, @h: 33); | |
} | |
all { | |
.FluidGutter(shredder, @all: 42); | |
} | |
} | |
// impl.: | |
.FluidGutter(@p, @t:0, @r:0, @b: 0, @l:0, @v: 0, @h: 0, @all: 0) { | |
// match if tlrb = 0 and all is not | |
.-(0, 0, 0, 0) when not(@all = 0) { | |
.DummyMakeGutter(@p, @all @all @all @all); | |
} | |
// match if tlrb = 0 and vh are not | |
.-(0, 0, 0, 0) when not(@v = 0) or not(@h = 0) { | |
.DummyMakeGutter(@p, @v @h @v @h); | |
} | |
// match if neither of above matches | |
.-(...) when (default()) { | |
.DummyMakeGutter(@p, @t @r @b @l); | |
} | |
.-(@t, @r, @b, @l); | |
// ^ mixin body is scoped so `.-` is usually fine | |
// even if you already have `.-` elsewhere | |
} | |
.DummyMakeGutter(@p, @value) { | |
@{p}: @value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment