start refactoring toCSS so we will be able to collect sourcemap information at the same time

This commit is contained in:
Luke Page
2013-07-11 22:08:38 +01:00
parent 24e2b01d6e
commit 4db7c883cf
26 changed files with 300 additions and 199 deletions

View File

@@ -9,15 +9,21 @@ tree.Assignment.prototype = {
accept: function (visitor) {
this.value = visitor.visit(this.value);
},
toCSS: function () {
return this.key + '=' + (this.value.toCSS ? this.value.toCSS() : this.value);
},
eval: function (env) {
if (this.value.eval) {
return new(tree.Assignment)(this.key, this.value.eval(env));
}
return this;
}
},
genCSS: function (env, output) {
output.add(this.key + '=');
if (this.value.genCSS) {
this.value.genCSS(env, output);
} else {
output.add(this.value);
}
},
toCSS: tree.toCSS
};
})(require('../tree'));