Skip to content

Commit

Permalink
Make sure to return callback at every turn.
Browse files Browse the repository at this point in the history
  • Loading branch information
doctyper committed Mar 31, 2014
1 parent 08b9838 commit 7314fea
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions index.js
Expand Up @@ -43,15 +43,18 @@ module.exports = function (fileName, opt) {

// Return if null
if (file.isNull()) {
return;
stream.push(file);
return callback();
}

// No stream support (yet?)
if (file.isStream()) {
return stream.emit("error", new gutil.PluginError({
stream.emit("error", new gutil.PluginError({
plugin: PLUGIN_NAME,
message: "Streaming not supported"
}));

return callback();
}

// Set first file
Expand All @@ -62,13 +65,12 @@ module.exports = function (fileName, opt) {
// Save buffer for later use
opt.files.src.push(file);

callback();
return callback();
}

function generateModernizr() {

function generateModernizr(callback) {
if (opt.files.src.length === 0) {
return;
return callback();
}

// Call customizr
Expand All @@ -92,6 +94,8 @@ module.exports = function (fileName, opt) {

// Pass data along
stream.push(file);

return callback();
});
}

Expand Down

0 comments on commit 7314fea

Please sign in to comment.