Skip to content

coldbox-elixir/extension-browserify

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 6 commits ahead of JeffreyWay:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

ColdBox Elixir Browserify Support

Step 1: Install

First ensure, that you're ColdBox Elixir version is up to date. It should be at least version 2 or newer.

npm install coldBox-elixir-browserify --save-dev

Step 2: Use It

// Gulpfile.js

var elixir = require( "coldBox-elixir" );

elixir( function( mix ) {
    mix.browserify( "main.js" );
    // mix.browserify(srcPath, outputPath, srcBaseDir, browserifyOptions)
} );

This will compile, by default, resources/assets/js/main.js to includes/js/main.js. Should you require a different source directory, either provide an optional path as the third argument to mix.browserify, or begin your path with ./. This will instruct Elixir to ignore any default base directories.

elixir( function( mix ) {
    mix.browserify( "./app/assets/js/main.js" );
} );

The same is true for the output path.

elixir( function( mix ) {
    mix.browserify( "./app/assets/js/main.js", "public/build/bundle.js" );
} );

Custom Options

The fourth argument to the browserify method is an options object that will be passed through to the browserify task.

elixir( function( mix ){

 mix.browserify( 'main.js', 'includes/javascripts/main.js', 'public/js', {} );

} );

Custom Transformers

While Browserify ships with the Partialify and Babelify transformers, you're free to install and add more if you wish by doing 2 simple steps:

  1. Install the transformer

npm install aliasify --save-dev

  1. update your Gulpfile.js by pushing the new transformer configuration via the elixir.config.js.browserify.transformers array:
elixir.config.js.browserify.transformers.push( {

 name : 'aliasify',

 options : {}

} );

elixir( function( mix ){

 mix.browserify( 'main.js' );

} );

Contributions and Bugs

Project tracking for this project can be found at the Ortus Solutions Jira. Please log all bugs, improvements, and features there.

Pull requests are welcome and encouraged. Please check on the Jira page before starting any large amount of work so your time isn't wasted.

Brad Wood (@bdw429s) has a great guide on submitting pull requests. If you are unsure where to go, in need of help, or have a question, come ask in the #box-products channel on the CFML Slack.

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%