fix: use raw string to prevent quote issues

This commit is contained in:
Alexander Navarro 2025-04-14 11:31:59 -04:00
parent f6077d4a1d
commit a1b480fc47

View file

@ -56,11 +56,9 @@ out += "|env: &mut minijinja::Environment| {\n";
for (const res of result.outputs) {
// Can be consumed as blobs
let asset_text = await res.text();
asset_text = asset_text.replaceAll(/\n/g, "\\n");
asset_text = asset_text.replaceAll(/"/g, `\\"`);
const asset_text = await res.text();
const asset_path = path.normalize(res.path);
out += `env.add_template("${asset_path}", "${asset_text}").expect("Embedded an invalid template");\n`;
out += `env.add_template("${asset_path}", r##"${asset_text}"##).expect("Embedded an invalid template");\n`;
}
out += "}";
@ -71,4 +69,3 @@ Bun.write(
);
console.log("Assets compiled!");