Skip to content

Commit

Permalink
Dont generate legacy render js in wasm mode (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Jan 2, 2024
1 parent 938ea32 commit a7b6da2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
16 changes: 7 additions & 9 deletions website/src/assets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,13 @@ impl AssetPaths {
dir.create_compressed_file(&format!("{hash}.png"), contents)
};

let subaction_render_js = {
let legacy_subaction_render_js = if args.legacy_renderer {
let contents = include_str!("subaction_render.js");

let minified = contents;
// let minified = minifier::js::minify(&contents); // TODO: Welp ... this is very clearly broken.
// Can't complain though, the minifier repo does say its not ready yet :P

let hash = hash(minified.as_bytes());
dir.create_compressed_file(&format!("{hash}.js"), minified.as_bytes())
let hash = hash(contents.as_bytes());
dir.create_compressed_file(&format!("{hash}.js"), contents.as_bytes())
} else {
String::new()
};

const WASM_FILE_NAME: &str = "fighter_renderer_bg.wasm";
Expand Down Expand Up @@ -137,7 +135,7 @@ impl AssetPaths {
favicon_png,
spritesheet_png,
style_css,
subaction_render_js,
legacy_subaction_render_js,
fighter_renderer_wasm,
fighter_renderer_js,
}
Expand All @@ -149,7 +147,7 @@ pub struct AssetPaths {
pub favicon_png: String,
pub spritesheet_png: String,
pub style_css: String,
pub subaction_render_js: String,
pub legacy_subaction_render_js: String,
pub fighter_renderer_wasm: String,
pub fighter_renderer_js: String,
}
2 changes: 1 addition & 1 deletion website/templates/subaction.html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@

{{#if legacy_renderer}}
<script src="https://unpkg.com/three@0.94.0/build/three.min.js"></script>
<script src="{{assets.subaction_render_js}}"></script>
<script src="{{assets.legacy_subaction_render_js}}"></script>
{{else}}
<script type="module">
import init, { run } from "{{assets.fighter_renderer_js}}";
Expand Down

0 comments on commit a7b6da2

Please sign in to comment.