diff --git a/lib/js-recipe.js b/lib/js-recipe.js index 38bd957..49e736b 100644 --- a/lib/js-recipe.js +++ b/lib/js-recipe.js @@ -14,7 +14,7 @@ * hint - boolean or object passed through to gulp-jshint * angular - boolean or object passed through to gulp-ng-annotate * sourcemaps - boolean (true for dev by default) - * browserify - boolean + * browserify - boolean or object passed through to browserify */ // Gulp deps: @@ -26,6 +26,7 @@ var gulpConnect = require('gulp-connect'); var gulpUglify = require('gulp-uglify'); var gulpUtil = require('gulp-util'); var map = require('map-stream'); +var notifier = require('node-notifier'); // Optional deps: var browserify = require('browserify'); @@ -97,7 +98,7 @@ function jsBase (src, out, dest, options, watch) { if (watch) { bundler = watchify(browserify(src, _.extend({ debug: options.sourcemaps - }, watchify.args))); + }, options.browserify, watchify.args))); } else { bundler = browserify(src, { debug: options.sourcemaps @@ -129,8 +130,13 @@ function jsBase (src, out, dest, options, watch) { js = bundler.bundle() // Log errors if they happen .on('error', function (e) { - gulpUtil.log('Browserify Error: "' + e.description + '"'); - gulpUtil.log(e.lineNumber + ', ' + e.column + ': ' + e.filename); + var title = 'Browserify Error'; + var message = e.message; + gulpUtil.log(title + ':\n' + message); + notifier.notify({ + title: title, + message: message + }); }) .pipe(vinylSourceStream(out)); } diff --git a/lib/less-recipe.js b/lib/less-recipe.js index 190bb17..8e15e68 100644 --- a/lib/less-recipe.js +++ b/lib/less-recipe.js @@ -21,6 +21,7 @@ var gulpConcat = require('gulp-concat'); var gulpConnect = require('gulp-connect'); var gulpLess = require('gulp-less'); var gulpSourcemaps = require('gulp-sourcemaps'); +var notifier = require('node-notifier'); // Unused. This would be handy for determining // which tasks to watch. @@ -69,7 +70,16 @@ function less (src, out, options) { // Pass options along to gulp-less: gulpLess(options.less) // Log less error messages: - .on('error', gulpUtil.log) + .on('error', function (e) { + var title = 'Less Error'; + var message = e.message; + gulpUtil.log(title + ':\n' + message); + notifier.notify({ + title: title, + message: message + }); + + }) ); if (options.sourcemaps) { stream = stream.pipe(gulpSourcemaps.write()); diff --git a/package.json b/package.json index 67e3e14..f691334 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "gulp-jade": "^0.9.0", "mkdirp": "^0.5.0", "less-imports": "^1.1.0", - "vinyl-buffer": "^1.0.0" + "vinyl-buffer": "^1.0.0", + "node-notifier": "^4.0.2" } }