Adds C-style preprocessor directive support to HTML brunch compilations. This allows you to have the same source files, but multiple environments specified in your config-brunch.coffee file to compile for different environments.
"html-preprocess-brunch": "x.y.z" to
package.json of your brunch app.
brunch-config.coffee file of your brunch app, add a line to specify your
buildEnv. In the
overrides section, add other environments
It can also be helpful to have different public paths for each config. That way different environments with different buildTarget's will compile their output to different folders.
exports.config =buildEnv: 'debug'paths:public: 'debug'overrides:release:buildEnv: 'release'paths:public: 'release'...
Add Directives to Code
Directives for if, else, elseif, and endif are available to control what html gets compiled. Each must be on its own line and prepended by the comment op (
`<!-- @if (PRODUCTION) -->`...`<!-- @elseif (DEBUG) -->`...`<!-- @else -->`...`<!-- @endif -->`
Note the use of parentheses. Unlike C preprocessor directives, those parentheses are required for
@elseif directives also support the OR (||) operator.
<!-- @if (PRODUCTION || iOS) -->
@ifstatements are not yet supported.
Compile Your Brunch App
Using the above example, it will compile debug by default and override for release when using the environment variable:
brunch build -e release