Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
watch seed files
Browse files Browse the repository at this point in the history
  • Loading branch information
subosito committed Oct 4, 2017
1 parent 2f859aa commit 017112e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 11 additions & 0 deletions parser/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 017112e

Please sign in to comment.