Last active
January 2, 2016 01:39
-
-
Save spion/8231946 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var less = require("less"), | |
Promise = require("promise"); | |
module.exports = function(options) { | |
return function(inputs) { | |
return Promise.all(inputs.map(lessp)).then(function(css) { return css.join(''); }); | |
}; | |
}; | |
function lessp(input) { | |
return input.getContents().then(compile); | |
}; | |
function compile(buffer) { | |
return new Promise(function(resolve, reject) { | |
less.compile(buffer.toString(), function(err, css) { | |
if(err) reject(err); else resolve(css); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment