mirror of
https://github.com/less/less.js.git
synced 2026-01-26 15:48:31 -05:00
(test) mixin-guards
This commit is contained in:
20
test/css/mixins-guards.css
Normal file
20
test/css/mixins-guards.css
Normal file
@@ -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;
|
||||
}
|
||||
46
test/less/mixins-guards.less
Normal file
46
test/less/mixins-guards.less
Normal file
@@ -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 }
|
||||
Reference in New Issue
Block a user