carto/lib/less/tree/directive.js
cloudhead b38f5325c9 Refactored some of the evaluation mechanisms
- Don't call `eval` from `toCSS`
- Every node responds to `eval`
2010-05-07 23:21:16 -04:00

22 lines
631 B
JavaScript

if (typeof(require) !== 'undefined') { var tree = require('less/tree') }
tree.Directive = function Directive(name, value) {
this.name = name;
if (Array.isArray(value)) {
this.rules = value;
} else {
this.value = value;
}
};
tree.Directive.prototype.toCSS = function () {
if (this.rules) {
return this.name + " {\n " +
this.rules.map(function (r) {
return r.toCSS();
}).join("\n ") + "\n}\n";
} else {
return this.name + ' ' + this.value.toCSS() + ';\n';
}
};
tree.Directive.prototype.eval = function () { return this }