mirror of
https://github.com/less/less.js.git
synced 2026-04-09 03:00:20 -04:00
Use native Promises when available
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var Promise = require('promise');
|
||||
var PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise;
|
||||
var less = require("./non-node-index.js");
|
||||
|
||||
less.render = function (input, options, callback) {
|
||||
@@ -22,7 +22,7 @@ less.render = function (input, options, callback) {
|
||||
callback(null, css);
|
||||
});
|
||||
} else {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new PromiseConstructor(function (resolve, reject) {
|
||||
parser.parse(input, function (e, root) {
|
||||
if (e) { return reject(e); }
|
||||
try { resolve(root.toCSS(options)); }
|
||||
|
||||
Reference in New Issue
Block a user