Skip to content

Commit

Permalink
watcher: expose options via config.chokidar
Browse files Browse the repository at this point in the history
- see #296
  • Loading branch information
enzy committed Aug 14, 2019
1 parent 0a3de8a commit 835032b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ All options can be overridden in `mango.local.yaml` (or `mango.local.json`) file
* `browsersync` - options passed to [BrowserSync](http://www.browsersync.io/docs/options/) dev server
* `proxy` - start dev server in [proxy mode](http://www.browsersync.io/docs/options/#option-proxy)
* `watch` - additional files to watch resulting in browser reload
* `chokidar` - [extra options](https://github.com/paulmillr/chokidar#performance) passed to [chokidar](https://github.com/paulmillr/chokidar) file watcher. [Defaults...](https://github.com/manGoweb/mango-cli/blob/master/lib/mango.js#L221)

---

Expand Down
5 changes: 3 additions & 2 deletions lib/mango.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const _ = require('lodash')
const c = require('better-console')
const minimatch = require('minimatch')
const path = require('path')
Expand Down Expand Up @@ -217,13 +218,13 @@ Mango.prototype._watch = function(glob, callback) {

if(!this.watcher){
var chokidar = require('chokidar')
this.watcher = chokidar.watch(basedir, {
this.watcher = chokidar.watch(basedir, _.assign({}, {
ignored: /[\/\\]\./,
ignoreInitial: true,
persistent: true,
ignorePermissionErrors: true,
usePolling: false,
})
}, this.config.chokidar))
}

this.watcher.on('all', function(event, filepath) {
Expand Down

0 comments on commit 835032b

Please sign in to comment.