Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browserify multiple files into a single bundle

Currently, I browserify a single js file into a bundle.js

$ browserify X1.js --standalone XXX > bundle.js

What if I have multiple js files and want to join them into a single browserified bundle.js

How should the command look like? Can I do something like this?

$ browserify X1.js X2.js --standalone XXX > bundle.js

I am using node.js v6

like image 476
guagay_wk Avatar asked Nov 08 '16 10:11

guagay_wk


2 Answers

You have already answered your own question. I confirm that it is correct.

$ browserify X1.js X2.js --standalone XXX > bundle.js
like image 161
guagay_wk Avatar answered Oct 27 '22 01:10

guagay_wk


If your command line supports expansion, you can use * to include all files in a directory:

$ browserify *.js --standalone XXX > distribution/bundle.js
like image 40
fregante Avatar answered Oct 27 '22 02:10

fregante