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 - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "jspreprocess-brunch",
"version": "1.0.0",
"version": "1.0.1",
"description": "Adds js preprocessor support to js brunch compilations.",

@@ -5,0 +5,0 @@ "main": "./lib/index",

@@ -1,2 +0,56 @@

## jspreprocess-brunch
Adds js preprocessor support to brunch compilations.
# jspreprocess-brunch
Adds C-style preprocessor directive support to JS [brunch](http://brunch.io) 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`
```coffeescript
exports.config =
buildTarget: 'PRODUCTION'
paths:
public: 'prod'
...
```
ex: `config_debug.coffee`
```coffeescript
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.
```javascript
// #BRUNCH_IF (PRODUCTION)
...
// #BRUNCH_ELIF (DEBUG)
...
// #BRUNCH_ELSE
...
// #BRUNCH_ENDIF
```
Note the use of parentheses. Unlike C preprocessor directives, those parenthese will be required here for if and 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`
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