Bundle JS files inside pull-stream with Browserify
Bundles the js pull-stream files using Browserify
var pull = require('pull-stream')
var { read, write } = require('pull-files')
var bundle = require('pull-bundle-js')
pull(
read([ 'index.js', 'lib/**/*.js' ], { cwd: __dirname }),
bundle('app.js', ['babelify', 'es2040']),
write('out', err => {
// finished
})
)
npm i pull-bundle-js
Bundles commonjs files using Browserify to use commonjs modules and several Node.js built-ins on the browser
The options
are passed to browserify(options)
, in addition to:
path
: Path of the resulting bundle. Optional if the path will never be used (e.g. goes into HTML directly after)strict
: Only allow files with.js
to pass through. Defaults tofalse
You can also pass options
as an array as a shorthand for transforms: [ ...options ]
pull-files
for reading and writing filespull-bundle-html
put your JS and CSS into a boilerplate HTML filepull-minify-js
to minify it