mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
add browserify (not yet working) and refactor tree nodes to not be dependent on their parent (currently breaks browser build)
This commit is contained in:
29
lib/less/tree/attribute.js
Normal file
29
lib/less/tree/attribute.js
Normal file
@@ -0,0 +1,29 @@
|
||||
module.exports = function (tree) {
|
||||
|
||||
var Attribute = function (key, op, value) {
|
||||
this.key = key;
|
||||
this.op = op;
|
||||
this.value = value;
|
||||
};
|
||||
Attribute.prototype = {
|
||||
type: "Attribute",
|
||||
eval: function (env) {
|
||||
return new(Attribute)(this.key.eval ? this.key.eval(env) : this.key,
|
||||
this.op, (this.value && this.value.eval) ? this.value.eval(env) : this.value);
|
||||
},
|
||||
genCSS: function (env, output) {
|
||||
output.add(this.toCSS(env));
|
||||
},
|
||||
toCSS: function (env) {
|
||||
var value = this.key.toCSS ? this.key.toCSS(env) : this.key;
|
||||
|
||||
if (this.op) {
|
||||
value += this.op;
|
||||
value += (this.value.toCSS ? this.value.toCSS(env) : this.value);
|
||||
}
|
||||
|
||||
return '[' + value + ']';
|
||||
}
|
||||
};
|
||||
return Attribute;
|
||||
};
|
||||
Reference in New Issue
Block a user