Sha256: 3ba65baabeac264856bfcfc95b332f81d9b9f775da2f4505de58c1d459868441

Contents?: true

Size: 1.27 KB

Versions: 5

Compression:

Stored size: 1.27 KB

Contents

var PromiseConstructor;

module.exports = function(environment, ParseTree, ImportManager) {
    var render = function (input, options, callback) {
        if (typeof options === 'function') {
            callback = options;
            options = {};
        }

        if (!callback) {
            if (!PromiseConstructor) {
                PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise;
            }
            var self = this;
            return new PromiseConstructor(function (resolve, reject) {
                render.call(self, input, options, function(err, output) {
                    if (err) {
                        reject(err);
                    } else {
                        resolve(output);
                    }
                });
            });
        } else {
            this.parse(input, options, function(err, root, imports, options) {
                if (err) { return callback(err); }

                var result;
                try {
                    var parseTree = new ParseTree(root, imports);
                    result = parseTree.toCSS(options);
                }
                catch (err) { return callback(err); }

                callback(null, result);
            });
        }
    };

    return render;
};

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
ilog-0.4.1 node_modules/less/lib/less/render.js
ilog-0.4.0 node_modules/less/lib/less/render.js
ilog-0.3.3 node_modules/less/lib/less/render.js
less-execjs-2.6.0.4 lib/less/js/less/lib/less/render.js
less-execjs-2.6.0.3 lib/less/js/less/lib/less/render.js