From 67e28cac7e1963edaaaef8756c8a7acbe4395e0e Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 13 Mar 2017 13:17:20 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Don=E2=80=99t=20halt=20Gulp=20watch=20on=20?= =?UTF-8?q?JS/SASS=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem --- You make a minor typo, save the file and your Gulp process dies without you realising. You then spend 5 minutes trying to work out why your changes aren’t appearing, no matter what edits you make. Solution --- Catch errors raised in processing the JS/SASS files and log them, without killing the process. How --- Use a handy plugin called [Gulp PrettyError](https://www.npmjs.com/package/gulp-prettyerror). --- gulpfile.babel.js | 2 ++ package.json | 1 + 2 files changed, 3 insertions(+) diff --git a/gulpfile.babel.js b/gulpfile.babel.js index d6356a587..ab087224b 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -66,6 +66,7 @@ gulp.task('javascripts', () => gulp paths.src + 'javascripts/listEntry.js', paths.src + 'javascripts/main.js' ]) + .pipe(plugins.prettyerror()) .pipe(plugins.babel({ presets: ['es2015'] })) @@ -83,6 +84,7 @@ gulp.task('javascripts', () => gulp gulp.task('sass', () => gulp .src(paths.src + '/stylesheets/main*.scss') + .pipe(plugins.prettyerror()) .pipe(plugins.sass({ outputStyle: 'compressed', includePaths: [ diff --git a/package.json b/package.json index e8dd5e436..e9338145b 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "devDependencies": { "gulp-css-url-adjuster": "0.2.3", "gulp-jshint": "2.0.0", + "gulp-prettyerror": "1.2.1", "gulp-sass-lint": "1.1.1", "jshint": "2.9.1", "jshint-stylish": "2.1.0" From 06e66cdee00e92771e0a422292d69bc02043045a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 13 Mar 2017 13:40:46 +0000 Subject: [PATCH 2/2] Upgrade Gulp SASS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gulp was spitting out a lot of noise about stuff being out of date. The cause seemed to be our outdated version of Gulp SASS. This commit upgrades Gulp SASS to the latest version. Changes: --- https://github.com/dlmanning/gulp-sass/compare/v2.3.1...v3.1.0 This is a breaking change because one of the underlying libraries includes a breaking change. But looking at their release notes, it doesn’t seem to affect any SASS features that we’re using: https://github.com/sass/libsass/releases/tag/3.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e9338145b..0f67bdf70 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "gulp-concat": "2.6.0", "gulp-include": "2.1.0", "gulp-load-plugins": "1.1.0", - "gulp-sass": "2.2.0", + "gulp-sass": "3.1.0", "gulp-uglify": "1.5.1", "hogan": "1.0.2", "jquery": "1.11.2",