diff --git a/main.go b/main.go index 3bcf2449..466077ea 100644 --- a/main.go +++ b/main.go @@ -424,6 +424,12 @@ func watchHTML(c *cli.Context, input, output, tplFile, bind string) error { return err } + for _, s := range snowboard.Seeds(input) { + if err = watcher.Add(s); err != nil { + return err + } + } + fmt.Fprintf(c.App.Writer, "snowboard: listening on %s\n", bind) if err := serveHTML(bind, output); err != nil { diff --git a/parser/loader.go b/parser/loader.go index 5323cca8..23044c89 100644 --- a/parser/loader.go +++ b/parser/loader.go @@ -194,3 +194,14 @@ func process(s string, data interface{}, funcMap template.FuncMap) ([]byte, erro return z.Bytes(), nil } + +// Seeds lists filenames of API blueprint's seeds. +func Seeds(name string) []string { + d := newLoader(name) + + if _, err := d.parse(); err != nil { + return []string{} + } + + return d.seeds +}