feat: add custom html support

This commit is contained in:
mrxiaozhuox committed 2022-03-20 19:31:30 +08:00
1 parent 6b0d57abe5
commit e5dfe84eb1
3 files changed
+26 -6

No files matched your search

+11 -2
View File
@@ -18,8 +18,10 @@ pub enum Config {
#[clap(long, default_value = "web")]
platform: String,
},
/// Format Print Dioxus-Config.
FormatPrint {}
/// Format print Dioxus config.
FormatPrint {},
/// Create a custom html file.
CustomHtml {}
}
impl Config {
@@ -48,6 +50,13 @@ impl Config {
Config::FormatPrint {} => {
println!("{:#?}", crate::CrateConfig::new()?.dioxus_config);
}
Config::CustomHtml {} => {
let html_path = crate_root.join("index.html");
let mut file = File::create(html_path)?;
let content = include_str!("../../assets/index.html");
file.write_all(content.as_bytes())?;
log::info!("🚩 Create custom html file done.");
}
}
Ok(())
}