diff --git a/src/book/init.rs b/src/book/init.rs index ccae8e9a..5347759a 100644 --- a/src/book/init.rs +++ b/src/book/init.rs @@ -127,8 +127,20 @@ impl BookBuilder { let mut index = File::create(themedir.join("index.hbs"))?; index.write_all(theme::INDEX)?; - let mut css = File::create(themedir.join("book.css"))?; - css.write_all(theme::CSS)?; + let cssdir = themedir.join("css"); + fs::create_dir(&cssdir)?; + + let mut general_css = File::create(cssdir.join("general.css"))?; + general_css.write_all(theme::GENERAL_CSS)?; + + let mut chrome_css = File::create(cssdir.join("chrome.css"))?; + chrome_css.write_all(theme::CHROME_CSS)?; + + let mut print_css = File::create(cssdir.join("print.css"))?; + print_css.write_all(theme::PRINT_CSS)?; + + let mut variables_css = File::create(cssdir.join("variables.css"))?; + variables_css.write_all(theme::VARIABLES_CSS)?; let mut favicon = File::create(themedir.join("favicon.png"))?; favicon.write_all(theme::FAVICON)?; diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 2367446f..469f8ef4 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -139,7 +139,10 @@ impl HtmlHandlebars { )?; write_file(destination, "book.js", &theme.js)?; - write_file(destination, "book.css", &theme.css)?; + write_file(destination, "css/general.css", &theme.general_css)?; + write_file(destination, "css/chrome.css", &theme.chrome_css)?; + write_file(destination, "css/print.css", &theme.print_css)?; + write_file(destination, "css/variables.css", &theme.variables_css)?; write_file(destination, "favicon.png", &theme.favicon)?; write_file(destination, "highlight.css", &theme.highlight_css)?; write_file(destination, "tomorrow-night.css", &theme.tomorrow_night_css)?; diff --git a/src/theme/index.hbs b/src/theme/index.hbs index 45be723a..36d47754 100644 --- a/src/theme/index.hbs +++ b/src/theme/index.hbs @@ -9,29 +9,31 @@ - + + + + + + + + - - - - - + {{#each additional_css}} - + {{/each}} {{#if mathjax_support}} {{/if}} -
diff --git a/src/theme/mod.rs b/src/theme/mod.rs index 5ebbc57f..37d373ef 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -13,7 +13,10 @@ use errors::*; pub static INDEX: &'static [u8] = include_bytes!("index.hbs"); pub static HEADER: &'static [u8] = include_bytes!("header.hbs"); -pub static CSS: &'static [u8] = include_bytes!("book.css"); +pub static CHROME_CSS: &'static [u8] = include_bytes!("css/chrome.css"); +pub static GENERAL_CSS: &'static [u8] = include_bytes!("css/general.css"); +pub static PRINT_CSS: &'static [u8] = include_bytes!("css/print.css"); +pub static VARIABLES_CSS: &'static [u8] = include_bytes!("css/variables.css"); pub static FAVICON: &'static [u8] = include_bytes!("favicon.png"); pub static JS: &'static [u8] = include_bytes!("book.js"); pub static HIGHLIGHT_JS: &'static [u8] = include_bytes!("highlight.js"); @@ -44,7 +47,10 @@ pub static FONT_AWESOME_OTF: &'static [u8] = include_bytes!("FontAwesome/fonts/F pub struct Theme { pub index: Vec