Prepare JavaScript on build process
This commit is contained in:
parent
db581a955b
commit
d86bd898cb
20
build.rs
20
build.rs
@ -48,19 +48,13 @@ fn main() {
|
|||||||
create_dir_all(&Path::new("static").join("media")).expect("Couldn't init media directory");
|
create_dir_all(&Path::new("static").join("media")).expect("Couldn't init media directory");
|
||||||
|
|
||||||
let cache_id = &compute_static_hash()[..8];
|
let cache_id = &compute_static_hash()[..8];
|
||||||
println!("cargo:rerun-if-changed=target/deploy/plume-front.wasm");
|
println!("cargo:rerun-if-changed=plume-front/pkg/plume_front_bg.wasm");
|
||||||
copy("target/deploy/plume-front.wasm", "static/plume-front.wasm")
|
copy(
|
||||||
.and_then(|_| read_to_string("target/deploy/plume-front.js"))
|
"plume-front/pkg/plume_front_bg.wasm",
|
||||||
.and_then(|js| {
|
"static/plume_front_bg.wasm",
|
||||||
write(
|
)
|
||||||
"static/plume-front.js",
|
.and_then(|_| copy("plume-front/pkg/plume_front.js", "static/plume_front.js"))
|
||||||
js.replace(
|
.ok();
|
||||||
"\"plume-front.wasm\"",
|
|
||||||
&format!("\"/static/cached/{}/plume-front.wasm\"", cache_id),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.ok();
|
|
||||||
|
|
||||||
println!("cargo:rustc-env=CACHE_ID={}", cache_id)
|
println!("cargo:rustc-env=CACHE_ID={}", cache_id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user