Skip to content

Commit

Permalink
Added watch gulp script
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed Jan 11, 2016
1 parent 711145d commit d45f8df
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"bugs": "https://github.com/josdejong/jsoneditor/issues",
"scripts": {
"build": "gulp",
"watch": "watch",
"test": "mocha test"
},
"dependencies": {
Expand Down

0 comments on commit d45f8df

Please sign in to comment.