Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jspreprocess-brunch

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jspreprocess-brunch

Adds C-style preprocessor directive support to js brunch compilations.

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

jspreprocess-brunch

Adds C-style preprocessor directive support to JS brunch compilations. This allows you to have the same source files, but multiple config.coffee files to compile for different environments.

Setup

Add "jspreprocess-brunch": "x.y.z" to package.json of your brunch app.

In each config.coffee file of your brunch app, add a line to specify your buildTarget.

It can also be helpful to have different public paths for each config. That way different configurations with different buildTarget's will compile their output to different folders.

ex: config_prod.coffee

exports.config =
  buildTarget: 'PRODUCTION'
  paths:
    public: 'prod'
  ...

ex: config_debug.coffee

exports.config =
  buildTarget: 'DEBUG'
  paths:
    public: 'debug'
  ...

Add Directives to Code

Directives for if, else, elif, and endif are available to control what javascript gets compiled. Each must be on its own line and prepended by the double slash comment op.

// #BRUNCH_IF (PRODUCTION)
...

// #BRUNCH_ELIF (DEBUG)
...

// #BRUNCH_ELSE
...

// #BRUNCH_ENDIF

Note the use of parentheses. Unlike C preprocessor directives, those parentheses are required for #BRUNCH_IF and #BRUNCH_ELIF statements.

The #BRUNCH_IF and #BRUNCH_ELIF directives also support the OR (||) operator. ex: // #BRUNCH_IF (PRODUCTION || iOS)

  • Nested #BRUNCH_IF statements are not yet supported.

Compile Your Brunch App

Using the config_prod.coffee and config_debug.coffee examples from before, you can compile each config like so:

  • brunch build -c config_prod
  • brunch build -c config_debug

FAQs

Package last updated on 23 Apr 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc