mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Skip directories like node_modules from the watchlist
A local `node_modules` directory can easily contain tens of thousands of files, easily exhausting the tiny default max open files limit especially on OS X Yosemite, in spite of the fact that Hugo already had code in place since February 2014 to try to raise the maxfiles ulimit. Also skip `.git` and `bower_components` directories. The file watching situation will improve when https://github.com/go-fsnotify/fsevents become ready, but until then, we will be thrifty. :-) Thanks to @chibicode for the suggestion. See #168 for continued discussions.
This commit is contained in:
parent
f85d1a7da2
commit
b9b70fb6b0
1 changed files with 5 additions and 0 deletions
|
@ -292,6 +292,7 @@ func copyStatic() error {
|
|||
return syncer.Sync(publishDir, staticDir)
|
||||
}
|
||||
|
||||
// getDirList provides NewWatcher() with a list of directories to watch for changes.
|
||||
func getDirList() []string {
|
||||
var a []string
|
||||
walker := func(path string, fi os.FileInfo, err error) error {
|
||||
|
@ -318,6 +319,10 @@ func getDirList() []string {
|
|||
}
|
||||
|
||||
if fi.IsDir() {
|
||||
if fi.Name() == ".git" ||
|
||||
fi.Name() == "node_modules" || fi.Name() == "bower_components" {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
a = append(a, path)
|
||||
}
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue