diff --git a/README.md b/README.md index 717971c..8aa4792 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,17 @@ jsoneditor: ``` 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 diff --git a/gulpfile.js b/gulpfile.js index d19c377..eec15e1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -118,5 +118,11 @@ gulp.task('zip', shell.task([ '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`) gulp.task('default', ['bundle', 'bundle-css', 'copy-img', 'minify']); diff --git a/package.json b/package.json index 08503fa..3d1792d 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "bugs": "https://github.com/josdejong/jsoneditor/issues", "scripts": { "build": "gulp", + "watch": "watch", "test": "mocha test" }, "dependencies": {