From d93b5a3c07ac60f7926a12769074010455aa51ef Mon Sep 17 00:00:00 2001 From: Carl Sutherland Date: Mon, 10 Nov 2014 17:41:41 -0800 Subject: [PATCH 1/2] Initial notifications. * select node-notifier for triggering notifications * implement less and browserify notifications. --- lib/js-recipe.js | 10 ++++++++-- lib/less-recipe.js | 12 +++++++++++- package.json | 3 ++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/js-recipe.js b/lib/js-recipe.js index 38bd957..966d50f 100644 --- a/lib/js-recipe.js +++ b/lib/js-recipe.js @@ -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'); @@ -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" } } From 611c8274461820f7c7b0b374cbf9f1f692a2f4e4 Mon Sep 17 00:00:00 2001 From: Carl Sutherland Date: Fri, 14 Nov 2014 17:15:44 -0800 Subject: [PATCH 2/2] Add pass-through options to browserify. --- lib/js-recipe.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/js-recipe.js b/lib/js-recipe.js index 966d50f..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: @@ -98,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