From 1ee19240a840d8cd0dbbf1412d39f8147ac6d764 Mon Sep 17 00:00:00 2001 From: Michael Xander Date: Tue, 24 Jul 2018 15:09:40 +0200 Subject: [PATCH] 0.2.3: - Updated dependencies - Removed custom browserify error handler - Replaced deprecated gulp-util with fancy-log and ansi colors --- gulp/tasks/development/responsive-images.js | 2 +- gulp/tasks/development/scripts-browserify.js | 10 ++++++++-- gulp/tasks/development/styles.js | 3 ++- gulp/tasks/production/styles.js | 3 ++- gulp/util/bundleLogger.js | 12 +++++------- gulp/util/handleErrors.js | 15 --------------- package.json | 10 +++++----- 7 files changed, 23 insertions(+), 32 deletions(-) delete mode 100644 gulp/util/handleErrors.js diff --git a/gulp/tasks/development/responsive-images.js b/gulp/tasks/development/responsive-images.js index 14007c6..06ecb31 100644 --- a/gulp/tasks/development/responsive-images.js +++ b/gulp/tasks/development/responsive-images.js @@ -14,6 +14,6 @@ gulp.task('responsive-images', function() { .pipe(changed(config.dest)) .pipe(imageResize(config.options)) - .pipe(rename(function (path) { path.basename += config.outputSuffix; })) + .pipe(rename(function(path) { path.basename += config.outputSuffix; })) .pipe(gulp.dest(config.dest)); }); diff --git a/gulp/tasks/development/scripts-browserify.js b/gulp/tasks/development/scripts-browserify.js index 900fe47..35cd0db 100644 --- a/gulp/tasks/development/scripts-browserify.js +++ b/gulp/tasks/development/scripts-browserify.js @@ -5,8 +5,14 @@ var browsersync = require('browser-sync'); var browserify = require('browserify'); var source = require('vinyl-source-stream'); var watchify = require('watchify'); +var log = require('fancy-log'); var bundleLogger = require('../../util/bundleLogger'); -var handleErrors = require('../../util/handleErrors'); + +function onError(err) { + log('\x1b[31m' + 'Browserify Error:', err.message, '\x1b[0m'); + // Keep gulp from hanging on this task + this.emit('end'); +} // Run JavaScript through Browserify @@ -36,7 +42,7 @@ gulp.task('scripts-browserify', function(callback) { return bundler .bundle() // Report compile errors - .on('error', handleErrors) + .on('error', onError) // Use vinyl-source-stream to make the // stream gulp compatible. Specifiy the // desired output filename here. diff --git a/gulp/tasks/development/styles.js b/gulp/tasks/development/styles.js index 20ad3eb..f2f0629 100644 --- a/gulp/tasks/development/styles.js +++ b/gulp/tasks/development/styles.js @@ -11,8 +11,9 @@ var plumber = require('gulp-plumber'); var sourcemaps = require('gulp-sourcemaps'); var browsersync = require('browser-sync'); -function onError (err) { +function onError(err) { console.log(err); + // Keep gulp from hanging on this task this.emit('end'); } diff --git a/gulp/tasks/production/styles.js b/gulp/tasks/production/styles.js index d3b62e1..3d16c8e 100644 --- a/gulp/tasks/production/styles.js +++ b/gulp/tasks/production/styles.js @@ -10,8 +10,9 @@ var cssnano = require('cssnano'); var plumber = require('gulp-plumber'); var browsersync = require('browser-sync'); -function onError (err) { +function onError(err) { console.log(err); + // Keep gulp from hanging on this task this.emit('end'); } diff --git a/gulp/util/bundleLogger.js b/gulp/util/bundleLogger.js index 672b7a8..4f824ad 100644 --- a/gulp/util/bundleLogger.js +++ b/gulp/util/bundleLogger.js @@ -1,21 +1,19 @@ -/* bundleLogger - ------------ - Provides gulp style logs to the bundle method in browserify.js -*/ +// Provides gulp style logs to the bundle method in browserify.js -var gutil = require('gulp-util'); +var log = require('fancy-log'); var prettyHrtime = require('pretty-hrtime'); var startTime; + module.exports = { start: function(filepath) { startTime = process.hrtime(); - gutil.log('Bundling', gutil.colors.green(filepath)); + log('Bundling\x1b[32m', filepath, '\x1b[0m'); }, end: function(filepath) { var taskTime = process.hrtime(startTime); var prettyTime = prettyHrtime(taskTime); - gutil.log('Bundled', gutil.colors.green(filepath), 'in', gutil.colors.magenta(prettyTime)); + log('Bundled\x1b[32m', filepath, '\x1b[0m' + 'after' + '\x1b[35m', prettyTime, '\x1b[0m'); } }; diff --git a/gulp/util/handleErrors.js b/gulp/util/handleErrors.js deleted file mode 100644 index fc0aad2..0000000 --- a/gulp/util/handleErrors.js +++ /dev/null @@ -1,15 +0,0 @@ -var notify = require("gulp-notify"); - -module.exports = function() { - - var args = Array.prototype.slice.call(arguments); - - // Send error to notification center with gulp-notify - notify.onError({ - title: "Compile Error", - message: "<%= error.message %>" - }).apply(this, args); - - // Keep gulp from hanging on this task - this.emit('end'); -}; diff --git a/package.json b/package.json index 8f15456..7e2a662 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,17 @@ { "name": "gulp-jekyll", - "version": "0.2.2", + "version": "0.2.3", "description": "The build process for gulp-jekyll", "author": "Michael Xander", "repository": "michaelx/gulp-jekyll", "devDependencies": { - "browser-sync": "^2.24.4", + "browser-sync": "^2.24.6", "browserify": "^16.2.2", "browserify-shim": "^3.8.14", "css-mqpacker": "^6.0.2", "cssnano": "^3.10.0", "del": "^3.0.0", + "fancy-log": "^1.3.2", "gulp": "^3.9.1", "gulp-base64": "^0.1.3", "gulp-changed": "^3.2.0", @@ -22,11 +23,10 @@ "gulp-jshint": "^2.1.0", "gulp-jsonlint": "^1.2.1", "gulp-jsonminify": "^1.1.0", - "gulp-notify": "^3.2.0", "gulp-plumber": "^1.2.0", "gulp-postcss": "^7.0.1", "gulp-pretty-data": "^0.1.2", - "gulp-rename": "^1.3.0", + "gulp-rename": "^1.4.0", "gulp-rev": "^8.1.1", "gulp-rev-collector": "^1.3.1", "gulp-rsync": "0.0.8", @@ -39,7 +39,7 @@ "jshint-stylish": "^2.2.1", "postcss-advanced-variables": "^2.3.3", "postcss-nested": "^3.0.0", - "postcss-preset-env": "^5.2.0", + "postcss-preset-env": "^5.2.3", "postcss-reporter": "^5.0.0", "postcss-uncss": "^0.14.0", "pretty-hrtime": "^1.0.3",