Added watch gulp script

This commit is contained in:
jos 2016-01-11 09:49:42 +01:00
parent 711145da0c
commit d45f8df607
3 changed files with 18 additions and 1 deletions

View File

@ -124,7 +124,17 @@ jsoneditor:
``` ```
This will generate the files `./jsoneditor.js`, `./jsoneditor.css`, and This will generate the files `./jsoneditor.js`, `./jsoneditor.css`, and
minified versions in the root of the project. minified versions in the dist of the project.
- To automatically build when a source file has changed:
```
npm run watch
```
This will update `./jsoneditor.js` and `./jsoneditor.css` in the dist folder
on every change, but it will **NOT** update the minified versions as that's
an expensive operation.
## Custom builds ## Custom builds

View File

@ -118,5 +118,11 @@ gulp.task('zip', shell.task([
'zip ' + pkg + ' ' + 'README.md NOTICE LICENSE HISTORY.md index.html src dist docs examples -r ' 'zip ' + pkg + ' ' + 'README.md NOTICE LICENSE HISTORY.md index.html src dist docs examples -r '
])); ]));
// The watch task (to automatically rebuild when the source code changes)
// Does only generate jsoneditor.js and jsoneditor.css, not the minified versions
gulp.task('watch', ['bundle', 'bundle-css'], function () {
gulp.watch(['src/**/*.js'], ['bundle', 'bundle-css']);
});
// The default task (called when you run `gulp`) // The default task (called when you run `gulp`)
gulp.task('default', ['bundle', 'bundle-css', 'copy-img', 'minify']); gulp.task('default', ['bundle', 'bundle-css', 'copy-img', 'minify']);

View File

@ -19,6 +19,7 @@
"bugs": "https://github.com/josdejong/jsoneditor/issues", "bugs": "https://github.com/josdejong/jsoneditor/issues",
"scripts": { "scripts": {
"build": "gulp", "build": "gulp",
"watch": "watch",
"test": "mocha test" "test": "mocha test"
}, },
"dependencies": { "dependencies": {