reduce-js
Augment browserify
with the following features:
- Accept patterns to add entries.
- Use
watchify2
to watch files, which is able to detect new entries. - Use
common-bundle
to pack modules by default, which makeb.bundle()
output a stream manipulatable bygulp
plugins.
Example
Suppose we want to create one bundle for each js file in /path/to/src
,
and an additional common bundle to hold modules shared among them.
const reduce = const path = const del = const uglify = { var b = reduce return b} { var build = path del return b}
To watch file changes:
var b = b
To work with gulp:
var gulp = gulp gulp
API
var reduce = var b = reduce
reduce.create(entries, browserifyOptions, bundleOptions, watchifyOptions)
Return a browserify
instance.
entries
: patterns to locate input files. Check [globby
] for more details.browserifyOptions
: options forbrowserify
.bundleOptions
: options forcommon-bundle
.watchifyOptions
: options forwatchify2
. If truthy, file changes are watched.
b.bundle()
Return a [vinyl
] stream,
which can be processed by gulp plugins.
b
b.dest(outFolder, options)
The same with gulp.dest
.