Suppose I have the following mustache template:
This is a {{#BIG_HOUSE}}really big{{\BIG_HOUSE}} house with {{NUM_WINDOWS}} windows.
and I happen to know at compile time whether BIG_HOUSE is truthy or not. How do I pass this compile-time-constant-iness through to the template compiler?
Obviously in this case it's not very interesting, but in reality the template will be a lot larger and will include several such blocks.
I am currently using mustache-loader with webpack, so any solution specific to that would be great! I also have the UglifyJSPlugin for webpack, so perhaps there is some way of using that here?
The
mustache-loaderreturns a function which evaluates the template when given an object of parameters. This function can be executed using theapply-loader: