0.6.0 • Published 8 years ago
pull-bundle-js v0.6.0
pull-bundle-js
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
})
)Install
npm i pull-bundle-jsUsage
bundle(path?, options?)
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.jsto pass through. Defaults tofalse
You can also pass options as an array as a shorthand for transforms: [ ...options ]
Also see
pull-filesfor reading and writing filespull-bundle-htmlput your JS and CSS into a boilerplate HTML filepull-minify-jsto minify it