From a68ecba3e891ebda716f619a3491a508270b0a67 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 19 Feb 2018 20:35:14 -0600 Subject: [PATCH 1/5] add 'skipBinary' so gulp-replace doesnt break large images https://github.com/lazd/gulp-replace/issues/91 --- gulpfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 58f9553..db4e74a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -257,9 +257,9 @@ gulp.task('clean-vendor-assets', function () { // Copies the files to the /dist folder for distribution as simple theme gulp.task('dist', ['clean-dist'], function() { return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'**', '!'+paths.node, '!'+paths.node+'**', '!'+paths.dev, '!'+paths.dev+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '!'+paths.sass, '!'+paths.sass+'/**', '!readme.txt', '!readme.md', '!package.json', '!gulpfile.js', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', '*']) - .pipe(replace('/js/jquery.slim.min.js', '/js'+paths.vendor+'/jquery.slim.min.js')) - .pipe(replace('/js/popper.min.js', '/js'+paths.vendor+'/popper.min.js')) - .pipe(replace('/js/skip-link-focus-fix.js', '/js'+paths.vendor+'/skip-link-focus-fix.js')) + .pipe(replace('/js/jquery.slim.min.js', '/js'+paths.vendor+'/jquery.slim.min.js', {'skipBinary': true})) + .pipe(replace('/js/popper.min.js', '/js'+paths.vendor+'/popper.min.js', {'skipBinary': true})) + .pipe(replace('/js/skip-link-focus-fix.js', '/js'+paths.vendor+'/skip-link-focus-fix.js', {'skipBinary': true})) .pipe(gulp.dest(paths.dist)); }); From d8b45f064d31f3c840492d19eb26433e15292fa5 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 19 Feb 2018 20:44:32 -0600 Subject: [PATCH 2/5] fix paths, add files to ignored dist, and fix src buffer buffer false on gulp.src to allow large images to pass through safely. fix slash in front of bower and node. added package-lock and gulpconfig to ignored list. --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index db4e74a..6cd8262 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -256,7 +256,7 @@ gulp.task('clean-vendor-assets', function () { // gulp dist // Copies the files to the /dist folder for distribution as simple theme gulp.task('dist', ['clean-dist'], function() { - return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'**', '!'+paths.node, '!'+paths.node+'**', '!'+paths.dev, '!'+paths.dev+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '!'+paths.sass, '!'+paths.sass+'/**', '!readme.txt', '!readme.md', '!package.json', '!gulpfile.js', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', '*']) + return gulp.src(['**/*', '!'+paths.bower, '!'+paths.bower+'/**', '!'+paths.node, '!'+paths.node+'/**', '!'+paths.dev, '!'+paths.dev+'/**', '!'+paths.dist, '!'+paths.dist+'/**', '!'+paths.distprod, '!'+paths.distprod+'/**', '!'+paths.sass, '!'+paths.sass+'/**', '!readme.txt', '!readme.md', '!package.json', '!package-lock.json', '!gulpfile.js', '!gulpconfig.json', '!CHANGELOG.md', '!.travis.yml', '!jshintignore', '!codesniffer.ruleset.xml', '*'], {'buffer': false}) .pipe(replace('/js/jquery.slim.min.js', '/js'+paths.vendor+'/jquery.slim.min.js', {'skipBinary': true})) .pipe(replace('/js/popper.min.js', '/js'+paths.vendor+'/popper.min.js', {'skipBinary': true})) .pipe(replace('/js/skip-link-focus-fix.js', '/js'+paths.vendor+'/skip-link-focus-fix.js', {'skipBinary': true})) From e370d9a18fe455036cbb8b315bcaa3399d9d6c30 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 19 Feb 2018 21:29:16 -0600 Subject: [PATCH 3/5] wrapping imagemin in a watcher to insure it finishes Addresses issue #414 and similar where imagemin results in browsersync looping --- gulpconfig.json | 2 ++ gulpfile.js | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gulpconfig.json b/gulpconfig.json index 2280ad8..14bdd59 100644 --- a/gulpconfig.json +++ b/gulpconfig.json @@ -11,6 +11,8 @@ "paths" : { "js": "./js", "css": "./css", + "img": "./img", + "imgsrc": "./src/img", "sass": "./sass", "node": "./node_modules/", "bower": "./bower_components/", diff --git a/gulpfile.js b/gulpfile.js index 6cd8262..ee35432 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -101,16 +101,25 @@ gulp.task('watch', function () { gulp.watch([paths.dev + '/js/**/*.js','js/**/*.js','!js/theme.js','!js/theme.min.js'], ['scripts']); //Inside the watch task. - gulp.watch('./img/**', ['imagemin']) + gulp.watch(paths.imgsrc + '/**', ['imagemin-watch']); +}); + +/** + * Ensures the 'imagemin' task is complete before reloading browsers + * @verbose + */ +gulp.task('imagemin-watch', ['imagemin'], function(done) { + browserSync.reload(); + done(); }); // Run: // gulp imagemin // Running image optimizing task gulp.task('imagemin', function(){ - gulp.src('img/src/**') + gulp.src(paths.imgsrc + '/**') .pipe(imagemin()) - .pipe(gulp.dest('img')) + .pipe(gulp.dest(paths.img)) }); From e2098652cab395db4c654bfb1dab4a16bbfa929c Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 19 Feb 2018 21:46:08 -0600 Subject: [PATCH 4/5] updated README to reflect bs options location --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4b52188..a3ea9b2 100644 --- a/README.md +++ b/README.md @@ -95,11 +95,14 @@ To work and compile your Sass files on the fly start: Or, to run with Browser-Sync: -- First change the browser-sync options to reflect your environment in the file `/gulpfile.js` in the beginning of the file: -```javascript -var browserSyncOptions = { - proxy: "localhost/theme_test/", // <----- CHANGE HERE - notify: false +- First change the browser-sync options to reflect your environment in the file `/gulpconfig.json` in the beginning of the file: +```json +{ + "browserSyncOptions" : { + "proxy": "localhost/theme_test/", // <----- CHANGE HERE + "notify": false + }, + ... }; ``` - then run: `$ gulp watch-bs` From 5b1de5fd6588a6252cf3141c673d4c39a9023c42 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 19 Feb 2018 21:48:04 -0600 Subject: [PATCH 5/5] switch back to javascript highlighting (ick) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3ea9b2..e17f8cc 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ To work and compile your Sass files on the fly start: Or, to run with Browser-Sync: - First change the browser-sync options to reflect your environment in the file `/gulpconfig.json` in the beginning of the file: -```json +```javascript { "browserSyncOptions" : { "proxy": "localhost/theme_test/", // <----- CHANGE HERE