I am trying to use Promises with less.render in Node.js, but I am not getting the CSS returned that I would expect.
Here is the result I am getting:
{ domain: null, _events: {}, _maxListeners: 10 }
And this is the code block I am using:
var q = require("q")
, less = require("less")
;
var less_css = "@background: #131313; body{background:@background;}";
q.resolve( less.render(less_css) )
.then(function(output_css) {
// [UNEXPECTED RESULTS]
console.log(output_css);
},function (error) {
console.log('Error: ', error);
});
However, when I do it without the promises (as a regular old callback), it works...
var less = require("less");
var css = "@background: #131313; body{background:@background;}";
less.render(css, function(err, css_output){
console.log( css_output );
});
This block outputs the following css, which is what I was expecting from the promise:
body {
background: #131313;
}
Any help appreciated. Thanks :)