v0.13.8
This commit is contained in:
@@ -78,6 +78,7 @@ fn main() {
|
||||
println!("cargo:rerun-if-changed={}", preset_dir.display());
|
||||
|
||||
let theme_init_path = web_dir.join("theme-init.js");
|
||||
let lang_init_path = web_dir.join("lang-init.js");
|
||||
let styles_path = web_dir.join("styles.css");
|
||||
let index_path = web_dir.join("index.html");
|
||||
let not_found_path = web_dir.join("404.html");
|
||||
@@ -86,6 +87,7 @@ fn main() {
|
||||
let favicon_path = web_dir.join("favicon.svg");
|
||||
for path in [
|
||||
&theme_init_path,
|
||||
&lang_init_path,
|
||||
&styles_path,
|
||||
&index_path,
|
||||
¬_found_path,
|
||||
@@ -100,17 +102,22 @@ fn main() {
|
||||
let app_js_hash = content_hash(app_js.as_bytes());
|
||||
let theme_init_bytes = fs::read(&theme_init_path)
|
||||
.unwrap_or_else(|error| panic!("cannot read {}: {error}", theme_init_path.display()));
|
||||
let lang_init_bytes = fs::read(&lang_init_path)
|
||||
.unwrap_or_else(|error| panic!("cannot read {}: {error}", lang_init_path.display()));
|
||||
let styles_bytes = fs::read(&styles_path)
|
||||
.unwrap_or_else(|error| panic!("cannot read {}: {error}", styles_path.display()));
|
||||
let theme_init_hash = content_hash(&theme_init_bytes);
|
||||
let lang_init_hash = content_hash(&lang_init_bytes);
|
||||
let styles_hash = content_hash(&styles_bytes);
|
||||
let app_js_asset_path = format!("/app-{}.js", &app_js_hash[..12]);
|
||||
let theme_init_asset_path = format!("/theme-init-{}.js", &theme_init_hash[..12]);
|
||||
let lang_init_asset_path = format!("/lang-init-{}.js", &lang_init_hash[..12]);
|
||||
let styles_asset_path = format!("/styles-{}.css", &styles_hash[..12]);
|
||||
|
||||
let mut build_hash = fnv1a_update(0xcbf29ce484222325u64, app_js.as_bytes());
|
||||
for path in [
|
||||
&theme_init_path,
|
||||
&lang_init_path,
|
||||
&styles_path,
|
||||
&index_path,
|
||||
¬_found_path,
|
||||
@@ -189,12 +196,13 @@ fn main() {
|
||||
has_english = true;
|
||||
}
|
||||
|
||||
let language_hash = content_hash(source.as_bytes());
|
||||
manifest_languages.push(json!({
|
||||
"code": code,
|
||||
"name": name,
|
||||
"native_name": native_name,
|
||||
"locale": locale,
|
||||
"path": format!("lang/{code}.json")
|
||||
"path": format!("lang/{code}.json?v={}", &language_hash[..12])
|
||||
}));
|
||||
assets.push((code.to_owned(), path));
|
||||
}
|
||||
@@ -298,6 +306,10 @@ fn main() {
|
||||
"pub const THEME_INIT_ASSET_PATH: &str = {:?};\n",
|
||||
theme_init_asset_path
|
||||
));
|
||||
generated.push_str(&format!(
|
||||
"pub const LANG_INIT_ASSET_PATH: &str = {:?};\n",
|
||||
lang_init_asset_path
|
||||
));
|
||||
generated.push_str(&format!(
|
||||
"pub const STYLES_CSS_ASSET_PATH: &str = {:?};\n",
|
||||
styles_asset_path
|
||||
|
||||
Reference in New Issue
Block a user