mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Added a new function - extract for extracting padding values from a variable
This commit is contained in:
@@ -346,6 +346,11 @@ tree.functions = {
|
||||
shade: function(color, amount) {
|
||||
return this.mix(this.rgb(0, 0, 0), color, amount);
|
||||
},
|
||||
extract: function(index, values) {
|
||||
index = index.value - 1; // (1-based index)
|
||||
return values.value[index];
|
||||
},
|
||||
|
||||
"data-uri": function(mimetype, path) {
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
|
||||
@@ -108,3 +108,6 @@
|
||||
average: #7b007b;
|
||||
negation: #d73131;
|
||||
}
|
||||
#extract {
|
||||
result: 3 2 1 C B A;
|
||||
}
|
||||
|
||||
@@ -119,3 +119,8 @@
|
||||
average: average(#f60000, #0000f6);
|
||||
negation: negation(#f60000, #313131);
|
||||
}
|
||||
|
||||
#extract {
|
||||
@anon: A B C 1 2 3;
|
||||
result: extract(6, @anon) extract(5, @anon) extract(4, @anon) extract(3, @anon) extract(2, @anon) extract(1, @anon);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user