Add `watch` command (instead build after each change)

pull/150/head
A-312 4 years ago
parent 2a1209da26
commit 23a06e46a3

@ -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]). - `inputStyle` and `nativeSpellcheck` options to manage the native language of the browser (Thanks to [@firm1], [#143]).
### Changed ### Changed
- Delay before assuming that submit of the form as failed is `autosave.submit_delay` instead of `autosave.delay` (Thanks to [@Situphen], [#139]). - 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 ## [2.9.0] - 2020-01-13
### Added ### Added

@ -20,6 +20,13 @@ var banner = ['/**',
' */', ' */',
''].join('\n'); ''].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() { function lint() {
return gulp.src('./src/js/**/*.js') return gulp.src('./src/js/**/*.js')
.pipe(eslint()) .pipe(eslint())
@ -37,12 +44,6 @@ function scripts() {
} }
function styles() { 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) return gulp.src(css_files)
.pipe(concat('easymde.css')) .pipe(concat('easymde.css'))
.pipe(cleanCSS()) .pipe(cleanCSS())
@ -52,7 +53,14 @@ function styles() {
.pipe(gulp.dest('./dist/')); .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); var build = gulp.parallel(gulp.series(lint, scripts), styles);
gulp.task('default', build); gulp.task('default', build);
gulp.task('watch', gulp.series(build, watch));
gulp.task('lint', lint); gulp.task('lint', lint);

Loading…
Cancel
Save