From c60845816d0c7c5cb046a581c1077714ff740c98 Mon Sep 17 00:00:00 2001 From: Adam Onishi Date: Tue, 23 Feb 2016 11:51:29 +0000 Subject: [PATCH] fix error when no JS or Sass streams are returned --- lib/tasks/build.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/tasks/build.js b/lib/tasks/build.js index b794bedc..665953a6 100644 --- a/lib/tasks/build.js +++ b/lib/tasks/build.js @@ -21,12 +21,18 @@ module.exports = function(gulp, config) { const buildStream = merge(); const emitBuildStreamErrorEvent = buildStream.emit.bind(buildStream, 'error'); if (typeof config.watching === 'undefined' || config.watching === 'js') { - jsStream = module.exports.js(gulp, config) - .on('error', emitBuildStreamErrorEvent); + jsStream = module.exports.js(gulp, config); + + if (typeof jsStream !== 'undefined') { + jsStream.on('error', emitBuildStreamErrorEvent); + } } if (typeof config.watching === 'undefined' || config.watching === 'sass') { - sassStream = module.exports.sass(gulp, config) - .on('error', emitBuildStreamErrorEvent); + sassStream = module.exports.sass(gulp, config); + + if (typeof sassStream !== 'undefined') { + sassStream.on('error', emitBuildStreamErrorEvent); + } } if (jsStream && sassStream) { buildStream.add(jsStream, sassStream);