npm.io
2.0.0 • Published 7 years ago

broccoli-watchify

Licence
MIT
Version
2.0.0
Deps
12
Size
127 kB
Vulns
0
Weekly
0
Stars
6

broccoli-watchify Build Status

Gitter

The broccoli-watchify plugin bundles your assets with watchify.

Installation

npm install --save-dev broccoli-watchify

Example

const watchify = require('broccoli-watchify');

const options = {
  browserify: {
    entries: ['./app.js'],
    debug: true
  },
  nodeModulesPath: process.cwd() + '/node_modules', // provide the node_modules you want to resolve from
  outputFile: 'bundled/app.js',
  cache: true,
  init: function (b) {
    b.transform('reactify', {'es6': true});
    b.external('

API

watchify(tree, options)
Options
  • browserify: (defaults to {}) Options passed to the browserify constructor
  • outputFile: (defaults to "./browserify.js") Output file
  • cache: (defaults to true) A boolean flag to potentially switch the caching off and act like a plain browserify. Can be helpful in assembling bundles for production and not including all the full local path names in the bundle, which is not possible in the watchify mode.
  • init: (defaults to a no-op) A callback function that receives the browserify instance after it's created. Use this to call any of the browserify API methods on the instance, including add, require, external, exclude and so on.
  • nodeModulesPath: (defaults to process.cwd()/node_modules) Absolute path to node_modules.

Changelog

2.0.0
  • expose a way to configure which node_modules to resolve from
  • support broccoli 1x and 2x
  • modernize codebase
  • upgrade dependencies
1.0.0
  • No longer use watchify directly, as we do not require its watcher and it is not configurable. Rather we populate the cache, the same way watchify does.
  • Stable output, so downstream plugins aren't invalidated if our output doesn't change.
  • Much faster.
  • Basic tests.
  • Browserified files are browserified relative to the broccoli inputPath, not the realpath.
0.2.0
  • Add the init option to provide a possibility of configuration of the browserify instance with a custom function.
  • Remove the entries and require options.
  • Add the cache option to turn off the watchify behavior and act like a plain browserify.
0.1.3
  • Initial release

Contributors

The code of this plugin is originally based on the broccoli-browserify plugin by Gareth Andrew.

License

The MIT License (MIT). See LICENSE for details.

Copyright 2014 Andrey Subbotin.

); } }; const tree = watchify(tree, options);

API

watchify(tree, options)
  • __INLINE_CODE_0__: A broccoli tree or a directory path as a string
Options
  • __INLINE_CODE_1__: (defaults to __INLINE_CODE_2__) Options passed to the browserify constructor
  • __INLINE_CODE_3__: (defaults to __INLINE_CODE_4__) Output file
  • __INLINE_CODE_5__: (defaults to __INLINE_CODE_6__) A boolean flag to potentially switch the caching off and act like a plain browserify. Can be helpful in assembling bundles for production and not including all the full local path names in the bundle, which is not possible in the watchify mode.
  • __INLINE_CODE_7__: (defaults to a no-op) A callback function that receives the browserify instance after it's created. Use this to call any of the browserify API methods on the instance, including __INLINE_CODE_8__, __INLINE_CODE_9__, __INLINE_CODE_10__, __INLINE_CODE_11__ and so on.
  • __INLINE_CODE_12__: (defaults to __INLINE_CODE_13__) Absolute path to node_modules.

Changelog

2.0.0
  • expose a way to configure which node_modules to resolve from
  • support broccoli 1x and 2x
  • modernize codebase
  • upgrade dependencies
1.0.0
  • No longer use watchify directly, as we do not require its watcher and it is not configurable. Rather we populate the cache, the same way watchify does.
  • Stable output, so downstream plugins aren't invalidated if our output doesn't change.
  • Much faster.
  • Basic tests.
  • Browserified files are browserified relative to the broccoli __INLINE_CODE_14__, not the realpath.
0.2.0
  • Add the __INLINE_CODE_15__ option to provide a possibility of configuration of the browserify instance with a custom function.
  • Remove the __INLINE_CODE_16__ and __INLINE_CODE_17__ options.
  • Add the __INLINE_CODE_18__ option to turn off the watchify behavior and act like a plain browserify.
0.1.3
  • Initial release

Contributors

The code of this plugin is originally based on the broccoli-browserify plugin by Gareth Andrew.

License

The MIT License (MIT). See LICENSE for details.

Copyright 2014 Andrey Subbotin.

Keywords