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