get functions.js working
This commit is contained in:
parent
6ea12f7aa5
commit
60ac2374c9
@ -1,9 +1,11 @@
|
||||
functions = {
|
||||
if (typeof(window) === 'undefined') { var tree = require(require('path').join(__dirname, '..', 'less', 'tree')); }
|
||||
|
||||
tree.functions = {
|
||||
rgb: function (r, g, b) {
|
||||
return this.rgba(r, g, b, 1.0);
|
||||
},
|
||||
rgba: function (r, g, b, a) {
|
||||
return new(node.Color)([r, g, b, a]);
|
||||
return new(tree.Color)([r, g, b, a]);
|
||||
},
|
||||
hsl: function (h, s, l) {
|
||||
return this.hsla(h, s, l, 1.0);
|
||||
@ -23,3 +25,4 @@ functions = {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -6,6 +6,6 @@ tree.Call = function Call(name, args) {
|
||||
};
|
||||
tree.Call.prototype = {
|
||||
toCSS: function (context, env) {
|
||||
return that.functions[this.name].apply(functions, this.args).toCSS();
|
||||
return tree.functions[this.name].apply(tree.functions, this.args).toCSS();
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,8 @@
|
||||
var path = require('path');
|
||||
var tree = exports;
|
||||
|
||||
require.paths.unshift(__dirname);
|
||||
|
||||
['color', 'directive', 'operation', 'dimension',
|
||||
'keyword', 'variable', 'ruleset', 'element',
|
||||
'selector', 'quoted', 'expression', 'rule',
|
||||
@ -9,6 +11,8 @@ var tree = exports;
|
||||
process.mixin(tree, require(path.join('less', 'node', n)));
|
||||
});
|
||||
|
||||
require('functions');
|
||||
|
||||
tree.operate = function (op, a, b) {
|
||||
switch (op) {
|
||||
case '+': return a + b;
|
||||
|
Loading…
Reference in New Issue
Block a user