From be3418a269169fc77346bcf20705f4675cde0480 Mon Sep 17 00:00:00 2001 From: Michal Budzynski Date: Thu, 1 Jun 2017 13:11:39 +0200 Subject: [PATCH] Now changes to `theme` directory trigger rebuild for `mdbook serve` As `theme` dir is no longer under `src`. Updates to "theme" did not trigger book rebuild. Also fixed misleading docs about `theme` dir being located in `src` --- book-example/src/format/theme/theme.md | 2 +- src/bin/mdbook.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/book-example/src/format/theme/theme.md b/book-example/src/format/theme/theme.md index 11018511..95ece35d 100644 --- a/book-example/src/format/theme/theme.md +++ b/book-example/src/format/theme/theme.md @@ -4,7 +4,7 @@ The default renderer uses a [handlebars](http://handlebarsjs.com/) template to r included in the mdBook binary. The theme is totally customizable, you can selectively replace every file from the theme by your own by adding a -`theme` directory in your source folder. Create a new file with the name of the file you want to override +`theme` directory next to `src` folder in your project root. Create a new file with the name of the file you want to override and now that file will be used instead of the default file. Here are the files you can override: diff --git a/src/bin/mdbook.rs b/src/bin/mdbook.rs index 65ee8dbf..56179ef1 100644 --- a/src/bin/mdbook.rs +++ b/src/bin/mdbook.rs @@ -346,6 +346,9 @@ fn trigger_on_change(book: &mut MDBook, closure: F) -> () ::std::process::exit(0); }; + // Add the theme directory to the watcher + watcher.watch(book.get_theme_path(), Recursive).unwrap_or_default(); + // Add the book.{json,toml} file to the watcher if it exists, because it's not // located in the source directory if watcher