mdbook/book-example/src/cli/watch.md

27 lines
862 B
Markdown
Raw Normal View History

# The watch command
2018-08-02 16:52:54 -05:00
The `watch` command is useful when you want your book to be rendered on every
file change. You could repeatedly issue `mdbook build` every time a file is
changed. But using `mdbook watch` once will watch your files and will trigger a
build automatically whenever you modify a file.
#### Specify a directory
2018-08-02 16:52:54 -05:00
The `watch` command can take a directory as an argument to use as the book's
root instead of the current working directory.
2015-12-29 17:59:08 -05:00
```bash
mdbook watch path/to/book
```
2015-12-30 15:04:24 +01:00
2017-01-01 09:42:47 -08:00
#### --open
When you use the `--open` (`-o`) option, mdbook will open the rendered book in
your default web browser.
2015-12-30 15:04:24 +01:00
2017-01-17 00:11:39 +00:00
#### --dest-dir
The `--dest-dir` (`-d`) option allows you to change the output directory for the
book. If not specified it will default to the value of the `build.build-dir` key
in `book.toml`, or to `./book` relative to the book's root directory.