Sha256: d3e7db9f7c1ac1cc3f4b40af5444424e1bd49d442fd060131f768179012f12c2

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

(function (tree) {

tree.Directive = function (name, value, features) {
    this.name = name;

    if (Array.isArray(value)) {
        this.ruleset = new(tree.Ruleset)([], value);
        this.ruleset.allowImports = true;
    } else {
        this.value = value;
    }
};
tree.Directive.prototype = {
    toCSS: function (ctx, env) {
        if (this.ruleset) {
            this.ruleset.root = true;
            return this.name + (env.compress ? '{' : ' {\n  ') +
                   this.ruleset.toCSS(ctx, env).trim().replace(/\n/g, '\n  ') +
                               (env.compress ? '}': '\n}\n');
        } else {
            return this.name + ' ' + this.value.toCSS() + ';\n';
        }
    },
    eval: function (env) {
        env.frames.unshift(this);
        this.ruleset = this.ruleset && this.ruleset.eval(env);
        env.frames.shift();
        return this;
    },
    variable: function (name) { return tree.Ruleset.prototype.variable.call(this.ruleset, name) },
    find: function () { return tree.Ruleset.prototype.find.apply(this.ruleset, arguments) },
    rulesets: function () { return tree.Ruleset.prototype.rulesets.apply(this.ruleset) }
};

})(require('../tree'));

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
less-2.3.0 lib/less/js/lib/less/tree/directive.js
less-2.2.2 lib/less/js/lib/less/tree/directive.js
less-2.2.1 lib/less/js/lib/less/tree/directive.js
less-2.2.0 lib/less/js/lib/less/tree/directive.js
less-2.1.0 lib/less/js/lib/less/tree/directive.js
less-2.0.12 lib/less/js/lib/less/tree/directive.js
less-2.0.11 lib/less/js/lib/less/tree/directive.js
less-2.0.10 lib/less/js/lib/less/tree/directive.js