0.1.4 • Published 9 years ago

@skivvy/skivvy-package-browserify v0.1.4

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

Skivvy package: browserify

npm version Stability Build Status

Compile JavaScript using Browserify

Installation

skivvy install browserify

Overview

This package allows you to compile JavaScript using Browserify from within the Skivvy task runner.

Included tasks

browserify

Compile JavaScript using Browserify

Usage:

skivvy run browserify

Configuration settings:

NameTypeRequiredDefaultDescription
sourcestring Array<string>YesN/APath to source files
destinationstringYesN/APath to compiled output file
optionsobjectNo{}Browserify API options
options.watchboolean objectNofalseWhether to watch source files for changes using watchify
options.minifyboolean objectNofalseWhether to minify JS output using the uglifyify transform
options.envstring objectNonullSet environment variables and enable envify transform
options.babelifyboolean objectNofalseWhether to transform JS output using the babelify transform
options.requireArray<string,object>No[]Files to make available outside the bundle
options.externalArray<string>No[]Prevent files from being loaded into the current bundle
options.ignoreArray<string>No[]Prevent files from showing up in the output bundle (return {} when required)
options.excludeArray<string>No[]Prevent files from showing up in the output bundle (throw an error when required)
options.transformArray<string,object,function>No[]Browserify transforms
options.pluginArray<string,object,function>No[]Browserify plugins
Notes:
  • If the watch configuration setting is a key/value object, that object will be passed as the watchify() function's opts argument
  • If the minify configuration setting is a key/value object, that object will be used as the UglifyJS2 options
  • If the env configuration setting is a string, process.env.NODE_ENV will be set to that value. If it is a key/value object, all the contained values will be assigned to process.env as environment variables
  • If the babelify configuration setting is a key/value object, that object will be used as the babelify options
  • options.require is an array files to make available outside the bundle and any associated options:

    	```json
    	[
    		"./vendor/jquery/jquery.js",
    		"./vendor/d3/d3.js",
    		{
    			"file": "./vendor/angular/angular.js",
    			"options": { "expose": "angular" }
    		}
    	]
    	```
    
    	Each entry in `options.require` will be passed to the [`b.require()`](https://github.com/substack/node-browserify#brequirefile-opts) method.
  • options.external is an array of filenames that are prevented from being loaded into the current bundle:

    	```json
    	[
    		"./external/foo.js",
    		"./external/bar.js"
    	]
    	```
    
    	Each entry in `options.external` will be passed to the [`b.external()`](https://github.com/substack/node-browserify#bexternalfile) method.
  • options.ignore is an array of filenames that are prevented from showing up in the output bundle:

    	```json
    	[
    		"./hidden/foo.js",
    		"./hidden/bar.js"
    	]
    	```
    
    	Each entry in `options.ignore` will be passed to the [`b.ignore()`](https://github.com/substack/node-browserify#bignorefile) method.
  • options.exclude is an array of filenames that are prevented from showing up in the output bundle:

    	```json
    	[
    		"./hidden/foo.js",
    		"./hidden/bar.js"
    	]
    	```
    
    	Each entry in `options.exclude` will be passed to the [`b.exclude()`](https://github.com/substack/node-browserify#bexcludefile) method.
  • options.transform is an array of Browserify transforms and any associated options:

    	```json
    	[
    		"brfs",
    		"envify",
    		{
    			"transform": "babelify",
    			"options": { "nonStandard": false, "comments": false }
    		}
    	]
    	```
    
    	> _If configuration is being set programmatically, transforms can also be specified as functions instead of strings._
    
    	Each entry in `options.transforms` will be passed to the [`b.transform()`](https://github.com/substack/node-browserify#btransformtr-opts) method.
  • options.plugin is an array of Browserify plugins and any associated options:

    	```json
    	[
    		"my-plugin",
    		"another-plugin",
    		{
    			"plugin": "factor-bundle",
    			"options": { "outputs": [ "bundle/x.js", "bundle/y.js" ] }
    		},
    	]
    	```
    
    	> _If configuration is being set programmatically, plugins can also be specified as functions instead of strings._
    
    	Each entry in `options.plugin` will be passed to the [`b.plugin()`](https://github.com/substack/node-browserify#bpluginplugin-opts) method.

Returns:

Stream.Writable The output stream that is written to the filesystem