mirror of
https://github.com/less/less.js.git
synced 2026-01-24 14:48:00 -05:00
35 lines
851 B
JavaScript
35 lines
851 B
JavaScript
module.exports = function (tree) {
|
|
|
|
var Value = function (value) {
|
|
this.value = value;
|
|
};
|
|
Value.prototype = {
|
|
type: "Value",
|
|
accept: function (visitor) {
|
|
if (this.value) {
|
|
this.value = visitor.visitArray(this.value);
|
|
}
|
|
},
|
|
eval: function (env) {
|
|
if (this.value.length === 1) {
|
|
return this.value[0].eval(env);
|
|
} else {
|
|
return new(Value)(this.value.map(function (v) {
|
|
return v.eval(env);
|
|
}));
|
|
}
|
|
},
|
|
genCSS: function (env, output) {
|
|
var i;
|
|
for(i = 0; i < this.value.length; i++) {
|
|
this.value[i].genCSS(env, output);
|
|
if (i+1 < this.value.length) {
|
|
output.add((env && env.compress) ? ',' : ', ');
|
|
}
|
|
}
|
|
},
|
|
toCSS: tree.toCSS
|
|
};
|
|
return Value;
|
|
};
|