mirror of
https://github.com/less/less.js.git
synced 2026-02-10 06:55:09 -05:00
- support for returning Array values - Expressions/Values are passed as arrays to JavaScript - fixed some edge cases
29 lines
800 B
JavaScript
29 lines
800 B
JavaScript
(function (tree) {
|
|
|
|
tree.Quoted = function (str, content, escaped, i) {
|
|
this.escaped = escaped;
|
|
this.value = content || '';
|
|
this.quote = str.charAt(0);
|
|
this.index = i;
|
|
};
|
|
tree.Quoted.prototype = {
|
|
toCSS: function () {
|
|
if (this.escaped) {
|
|
return this.value;
|
|
} else {
|
|
return this.quote + this.value + this.quote;
|
|
}
|
|
},
|
|
eval: function (env) {
|
|
var that = this;
|
|
this.value = this.value.replace(/`([^`]+)`/g, function (_, exp) {
|
|
return new(tree.JavaScript)(exp, that.index, true).eval(env).value;
|
|
}).replace(/@\{([\w-]+)\}/g, function (_, name) {
|
|
return new(tree.Variable)('@' + name, that.index).eval(env).value;
|
|
});
|
|
return this;
|
|
}
|
|
};
|
|
|
|
})(require('less/tree'));
|