Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | (function (tree) { |
---|
2 | |
---|
3 | tree.Directive = function (name, value) { |
---|
4 | this.name = name; |
---|
5 | if (Array.isArray(value)) { |
---|
6 | this.ruleset = new(tree.Ruleset)([], value); |
---|
7 | } else { |
---|
8 | this.value = value; |
---|
9 | } |
---|
10 | }; |
---|
11 | tree.Directive.prototype = { |
---|
12 | toCSS: function (ctx, env) { |
---|
13 | if (this.ruleset) { |
---|
14 | this.ruleset.root = true; |
---|
15 | return this.name + (env.compress ? '{' : ' {\n ') + |
---|
16 | this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n ') + |
---|
17 | (env.compress ? '}': '\n}\n'); |
---|
18 | } else { |
---|
19 | return this.name + ' ' + this.value.toCSS() + ';\n'; |
---|
20 | } |
---|
21 | }, |
---|
22 | eval: function (env) { |
---|
23 | env.frames.unshift(this); |
---|
24 | this.ruleset = this.ruleset && this.ruleset.eval(env); |
---|
25 | env.frames.shift(); |
---|
26 | return this; |
---|
27 | }, |
---|
28 | variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) }, |
---|
29 | find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) }, |
---|
30 | rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) } |
---|
31 | }; |
---|
32 | |
---|
33 | })(require('less/tree')); |
---|
Note: See
TracBrowser
for help on using the repository browser.