Skip to content

Commit

Permalink
Merge pull request #198 from stevelacy/cb-fix
Browse files Browse the repository at this point in the history
fix the error passing in the stream
  • Loading branch information
stephenlacy committed Oct 22, 2015
2 parents f12e4e9 + be18b01 commit 7cfb836
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var less = accord.load('less');

module.exports = function (options) {
// Mixes in default options.
options = assign({}, {
opts = assign({}, {
compress: false,
paths: []
}, options);
Expand All @@ -26,14 +26,13 @@ module.exports = function (options) {

var str = file.contents.toString();

// Clones the options object
var opts = assign({}, options);

// Injects the path of the current file
opts.filename = file.path;

// Bootstrap source maps
if (file.sourceMap) { opts.sourcemap = true; }
if (file.sourceMap) {
opts.sourcemap = true;
}

less.render(str, opts).then(function(res) {
file.contents = new Buffer(res.result);
Expand All @@ -56,8 +55,7 @@ module.exports = function (options) {

// Add a better error message
err.message = err.message + ' in file ' + err.fileName + ' line no. ' + err.lineNumber;

throw new PluginError('gulp-less', err);
}).done(undefined, cb);
return cb(new PluginError('gulp-less', err));
});
});
};

0 comments on commit 7cfb836

Please sign in to comment.