Skip to content

Commit

Permalink
Watch all included files for live reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgtaylor committed Dec 17, 2014
1 parent fae001c commit 47f518d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Unreleased
* Fix live reload no longer working with some configurations
([#74](https://github.com/danielgtaylor/aglio/issues/74))
* Switch to [Remarkable](https://github.com/jonschlinkert/remarkable)
Markdown parser, which is faster and supports the new CommonMark
specification. [GFM](https://help.github.com/articles/github-flavored-markdown/)
is supported.
* Fix live reload no longer working with some configurations
([#74](https://github.com/danielgtaylor/aglio/issues/74))
* Watch all included files for live reloading.

# 1.17.0 - 2014-12-16
* New logo
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ aglio.getTemplates(function (err, names) {
```

#### aglio.collectPathsSync (blueprint, includePath)
Get a list of paths
Get a list of paths that are included in the blueprint. This list can be watched for changes to do things like live reload. The blueprint's own path is not included.

```javascript
var blueprint = '# GET /foo\n<-- include(example.json -->\n';
var watchPaths = aglio.collectPathsSync(blueprint, process.cwd())
```

#### aglio.render (blueprint, options, callback)
Render an API Blueprint string and pass the generated HTML to the callback. The `options` can either be an object of options or a simple template name or file path string. Available options are:
Expand Down
5 changes: 3 additions & 2 deletions src/bin.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ exports.run = (argv=parser.argv, done=->) ->
io.on "connection", () ->
console.log "Socket connected"

# TODO: Watch included files?
watcher = chokidar.watch argv.i
paths = aglio.collectPathsSync fs.readFileSync(argv.i, 'utf-8'), path.dirname(argv.i)

watcher = chokidar.watch [argv.i].concat(paths)
watcher.on "change", (path) ->
console.log "Updated " + path
_html = null
Expand Down

0 comments on commit 47f518d

Please sign in to comment.