2 let out_dir
= std
::env
::var("OUT_DIR").unwrap();
3 let context
= gpp
::Context
::new();
6 // Now onto the features.
7 context
.macros
.insert("WITH_REALLOCATOR".into(), String
::new());
9 #[cfg(feature = "svg")] {
10 context
.macros
.insert("WITH_SVG".into(), String
::new());
12 #[cfg(feature = "comment")] {
13 context
.macros
.insert("WITH_COMMENT".into(), String
::new());
15 #[cfg(feature = "document-fragment")] {
16 context
.macros
.insert("WITH_DOCUMENT_FRAGMENT".into(), String
::new());
19 out_dir
.join("vm.ts"),
22 "// This file is generated based on the required features, in order to keep file\n\
23 // size minimal while maintaining compatibility between the VM and client.\n\
24 // Therefore, don’t modify it directly.",
25 include_str!("vm.ts.template"),
32 out_dir
.join("vm.min.js"),
34 include_str!("vm.min.js.template"),
37 // Minified source: remove leading whitespace on each line, and all line breaks.
38 // (Aside: I love how smooth Rust makes this kind of operation.)
39 .lines().map(str::trim_start
).collect
::<String
>(),