Skip to content

Commit

Permalink
Handle sass.NULL returned from the importer via done()
Browse files Browse the repository at this point in the history
Whenever done() is called we should check for the sass.NULL
value as well.

While here, allow calling done(null) to anticipate
removal of the sass.NULL one day.

Fixes sass#1296
  • Loading branch information
saper committed Dec 20, 2015
1 parent 00ea12c commit f54461a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,27 +301,27 @@ module.exports.render = function(options, cb) {
if (Array.isArray(importer)) {
importer.forEach(function(subject, index) {
options.importer[index] = function(file, prev, bridge) {
function done(data) {
bridge.success(data);
function done(result) {
bridge.success(result === module.exports.NULL ? null : result);
}

var result = subject.call(options.context, file, prev, done);

if (result) {
done(result === module.exports.NULL ? null : result);
if (result !== undefined) {
done(result);
}
};
});
} else {
options.importer = function(file, prev, bridge) {
function done(data) {
bridge.success(data);
function done(result) {
bridge.success(result === module.exports.NULL ? null : result);
}

var result = importer.call(options.context, file, prev, done);

if (result) {
done(result === module.exports.NULL ? null : result);
if (result !== undefined) {
done(result);
}
};
}
Expand Down

0 comments on commit f54461a

Please sign in to comment.