Warning, /webapps/ocs-webserver/library/lessphp/tests/inputs/pattern_matching.less is written in an unsupported language. File is not indexed.
0001
0002 .demo (light, @color) {
0003 color: lighten(@color, 10%);
0004 }
0005 .demo (@_, @color) {
0006 display: block;
0007 }
0008
0009 @switch: light;
0010
0011 .class {
0012 .demo(@switch, #888);
0013 }
0014
0015 // by arity
0016
0017 .mixin () {
0018 zero: 0;
0019 }
0020 .mixin (@a: 1px) {
0021 one: 1;
0022 }
0023 .mixin (@a) {
0024 one-req: 1;
0025 }
0026 .mixin (@a: 1px, @b: 2px) {
0027 two: 2;
0028 }
0029
0030 .mixin (@a, @b, @c) {
0031 three-req: 3;
0032 }
0033
0034 .mixin (@a: 1px, @b: 2px, @c: 3px) {
0035 three: 3;
0036 }
0037
0038 .zero {
0039 .mixin();
0040 }
0041
0042 .one {
0043 .mixin(1);
0044 }
0045
0046 .two {
0047 .mixin(1, 2);
0048 }
0049
0050 .three {
0051 .mixin(1, 2, 3);
0052 }
0053
0054 //
0055
0056 .mixout ('left') {
0057 left: 1;
0058 }
0059
0060 .mixout ('right') {
0061 right: 1;
0062 }
0063
0064 .left {
0065 .mixout('left');
0066 }
0067 .right {
0068 .mixout('right');
0069 }
0070
0071 //
0072
0073 .border (@side, @width) {
0074 color: black;
0075 .border-side(@side, @width);
0076 }
0077 .border-side (left, @w) {
0078 border-left: @w;
0079 }
0080 .border-side (right, @w) {
0081 border-right: @w;
0082 }
0083
0084 .border-right {
0085 .border(right, 4px);
0086 }
0087 .border-left {
0088 .border(left, 4px);
0089 }
0090
0091 //
0092
0093
0094 .border-radius (@r) {
0095 both: @r * 10;
0096 }
0097 .border-radius (@r, left) {
0098 left: @r;
0099 }
0100 .border-radius (@r, right) {
0101 right: @r;
0102 }
0103
0104 .only-right {
0105 .border-radius(33, right);
0106 }
0107 .only-left {
0108 .border-radius(33, left);
0109 }
0110 .left-right {
0111 .border-radius(33);
0112 }
0113
0114 .hola(hello, @hello...) {
0115 color: blue;
0116 }
0117
0118 #hola {
0119 .hola(hello, world);
0120 .hola(jello, world);
0121 }
0122
0123 .resty(@hello, @world, @the_rest...) {
0124 padding: @hello @world;
0125 rest: @the_rest;
0126 }
0127
0128 #nnn {
0129 .body(10, 10, 10, 10, 10);
0130 .body(10, 10, 10);
0131 .body(10, 10);
0132 .body(10);
0133 .body();
0134 }
0135
0136 .defaults(@aa, @bb:e343, @cc: "heah", ...) {
0137 height: @aa;
0138 }
0139
0140 #defaults_1 {
0141 .defaults();
0142 .defaults(one);
0143 .defaults(two, one);
0144 .defaults(three, two, one);
0145 .defaults(four, three, two, one);
0146 }
0147
0148
0149 .thing() { color: green; }
0150 .thing(...) { color: blue; }
0151 .thing { color: red; }
0152
0153 #aa {
0154 .thing();
0155 }
0156
0157 #bb {
0158 .thing;
0159 }
0160
0161
0162 #cc {
0163 .thing(1);
0164 }
0165
0166
0167