I decided to update my gulp watch task, which every time a change occurs there, it starts gulp build while the ionic run android --livereload .
I added the --livereload flag to my gulp watch , so my /gulp/watch.js file looks like this:
gulp.task('watch', ['inject'], function () { var livereload = process.argv.length === 4 && process.argv[3] === '--livereload'; gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject-reload']); gulp.watch([ path.join(conf.paths.src, '/app/**/*.css'), path.join(conf.paths.src, '/app/**/*.scss'), path.join(conf.paths.src, '/scss/*.scss') ], function(event) { if (livereload) { gulp.start('build'); } else { if(isOnlyChange(event)) { gulp.start('styles-reload'); } else { gulp.start('inject-reload'); } } }); gulp.watch(path.join(conf.paths.src, '/app/**/*.js'), function(event) { if (livereload) { gulp.start('build'); } else { if(isOnlyChange(event)) { gulp.start('scripts-reload'); } else { gulp.start('inject-reload'); } } }); gulp.watch(path.join(conf.paths.src, '/app/**/*.html'), function(event) { if (livereload) { gulp.start('build'); } else { browserSync.reload(event.path); } }); });
How to use:
on the terminal tab:
ionic run android --livereload
and in another terminal tab:
gulp watch --livereload
Enjoy it!
source share