Skip to content

Commit

Permalink
makes browser reload for img and lib changes
Browse files Browse the repository at this point in the history
fixes #113
  • Loading branch information
vincentmorneau committed Aug 2, 2016
1 parent 61ca3d7 commit 3e5a3ea
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,22 @@ gulp.task('img', function() {
.pipe(gulp.dest(paths.dist + assets.img));
});

// watch for img changes
gulp.task('img-watch', ['img'], function() {
browsersync.reload();
});

// copy lib files as is
gulp.task('lib', function() {
return gulp.src(paths.src + assets.lib + allSubFolders + files.all)
.pipe(gulp.dest(paths.dist + assets.lib));
});

// copy lib files as is
gulp.task('lib-watch', ['lib'], function() {
browsersync.reload();
});

// creates a less file for theme roller
gulp.task('themeroller', function(){
return gulp.src(config.themeroller.files)
Expand Down Expand Up @@ -290,9 +300,13 @@ gulp.task('watch', function() {
gulp.watch(allSubFolders + files.less, { cwd: paths.src + assets.less }, ['themeroller']);
}

// img and lib
gulp.watch(allSubFolders + files.all, { cwd: paths.src + assets.img }, ['img']);
gulp.watch(allSubFolders + files.all, { cwd: paths.src + assets.lib }, ['lib']);
// img
var imgWatch = (config.browsersync.enabled ? ['img-watch'] : ['img']);
gulp.watch(allSubFolders + files.all, { cwd: paths.src + assets.img }, imgWatch);

// lib
var libWatch = (config.browsersync.enabled ? ['lib-watch'] : ['lib']);
gulp.watch(allSubFolders + files.all, { cwd: paths.src + assets.lib }, libWatch);
});

// Default task: builds your app
Expand Down

0 comments on commit 3e5a3ea

Please sign in to comment.