From 624c297e7be093bd2234c4fac8d2bfa085cfadae Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Sat, 24 Dec 2011 13:32:43 +0100 Subject: [PATCH] (test) mixin-guards --- test/css/mixins-guards.css | 20 ++++++++++++++++ test/less/mixins-guards.less | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 test/css/mixins-guards.css create mode 100644 test/less/mixins-guards.less diff --git a/test/css/mixins-guards.css b/test/css/mixins-guards.css new file mode 100644 index 00000000..5920d4f6 --- /dev/null +++ b/test/css/mixins-guards.css @@ -0,0 +1,20 @@ +.light1 { + color: white; + margin: 1px; +} +.light2 { + color: black; + margin: 1px; +} +.max1 { + width: 6; +} +.max2 { + width: 8; +} +.glob1 { + margin: auto auto; +} +.default1 { + content: default; +} diff --git a/test/less/mixins-guards.less b/test/less/mixins-guards.less new file mode 100644 index 00000000..dedf95b3 --- /dev/null +++ b/test/less/mixins-guards.less @@ -0,0 +1,46 @@ + +// Stacking, functions.. + +.light (@a) ? lightness(@a) > 50% { + color: white; +} +.light (@a) ? lightness(@a) < 50% { + color: black; +} +.light (@a) { + margin: 1px; +} + +.light1 { .light(#ddd) } +.light2 { .light(#444) } + +// Arguments against each other + +.max (@a, @b) ? @a > @b { + width: @a; +} +.max (@a, @b) ? @a < @b { + width: @b; +} + +.max1 { .max(3, 6) } +.max2 { .max(8, 1) } + +// Globals inside guards + +@g: auto; + +.glob (@a) ? @a = @g { + margin: @a @g; +} + +.glob1 { .glob(auto) } + +// Scope and default values + +@a: auto; + +.default (@a: inherit) ? @a = inherit { + content: default; +} +.default1 { .default }