Skip to content

Commit

Permalink
Merge pull request #5 from HumbleSoftware/feature/notifications
Browse files Browse the repository at this point in the history
Feature/notifications
  • Loading branch information
cesutherland committed Nov 15, 2014
2 parents 08efe79 + 611c827 commit ff7ef42
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
14 changes: 10 additions & 4 deletions lib/js-recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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');
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
Expand Down
12 changes: 11 additions & 1 deletion lib/less-recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit ff7ef42

Please sign in to comment.