From e78e4e6a2e787da8dbdc8514155dacaf159b5846 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Sat, 5 Aug 2017 13:35:10 -0300 Subject: [PATCH] watch: ignore usually big dirs Two items by now: - ".git" - "node_modules" --- watch.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/watch.go b/watch.go index ef6f67cd..60cd8ce8 100644 --- a/watch.go +++ b/watch.go @@ -9,6 +9,11 @@ import ( "github.com/radovskyb/watcher" ) +var watchIgnoredDirs = []string{ + ".git", + "node_modules", +} + // watchTasks start watching the given tasks func (e *Executor) watchTasks(args ...string) error { e.printfln("task: Started watching for tasks: %s", strings.Join(args, ", ")) @@ -34,6 +39,9 @@ func (e *Executor) watchTasks(args ...string) error { w := watcher.New() defer w.Close() w.SetMaxEvents(1) + if err := w.Ignore(watchIgnoredDirs...); err != nil { + return err + } go func() { for {