From 23a06e46a30dd0df61f3cc7ab3aa1ad230e7d79d Mon Sep 17 00:00:00 2001 From: A-312 Date: Thu, 6 Feb 2020 20:56:07 +0100 Subject: [PATCH] Add `watch` command (instead build after each change) --- CHANGELOG.md | 2 +- gulpfile.js | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eeb9a78..e4c7f49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser (Thanks to [@firm1], [#143]). ### Changed - Delay before assuming that submit of the form as failed is `autosave.submit_delay` instead of `autosave.delay` (Thanks to [@Situphen], [#139]). - +- Add `watch` task for gulp. ## [2.9.0] - 2020-01-13 ### Added diff --git a/gulpfile.js b/gulpfile.js index 6f3faea..5f9fcf1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,6 +20,13 @@ var banner = ['/**', ' */', ''].join('\n'); + +var css_files = [ + './node_modules/codemirror/lib/codemirror.css', + './src/css/*.css', + './node_modules/codemirror-spell-checker/src/css/spell-checker.css', +]; + function lint() { return gulp.src('./src/js/**/*.js') .pipe(eslint()) @@ -37,12 +44,6 @@ function scripts() { } function styles() { - var css_files = [ - './node_modules/codemirror/lib/codemirror.css', - './src/css/*.css', - './node_modules/codemirror-spell-checker/src/css/spell-checker.css', - ]; - return gulp.src(css_files) .pipe(concat('easymde.css')) .pipe(cleanCSS()) @@ -52,7 +53,14 @@ function styles() { .pipe(gulp.dest('./dist/')); } +// Watch for file changes +function watch() { + gulp.watch('./src/js/easymde.js', scripts) + gulp.watch(css_files, styles) +} + var build = gulp.parallel(gulp.series(lint, scripts), styles); gulp.task('default', build); +gulp.task('watch', gulp.series(build, watch)); gulp.task('lint', lint);