The following inside `config.toml` will ignore files ending with `.foo` and `.boo`.
```
watchIgnoreFiles = [ "\\.foo$", "\\.boo$" ]
```
The above is is a list of Reqular Expressions, but note the escaping of the `\` to make TOML happy.
Fixes #1189
import (
"bytes"
+ "github.com/spf13/viper"
"io"
"io/ioutil"
"os"
"path/filepath"
+ "regexp"
"strings"
"github.com/spf13/hugo/helpers"
return true
}
+ ignoreFiles := viper.GetStringSlice("WatchIgnoreFiles")
+ if len(ignoreFiles) > 0 {
+ for _, ignorePattern := range ignoreFiles {
+ match, _ := regexp.MatchString(ignorePattern, filePath)
+ if match {
+ return true
+ }
+ }
+ }
return false
}