Minify multiple files with UglifyJS

jcreamer898 picture jcreamer898 · Jan 11, 2012 · Viewed 28k times · Source

Is it possible to compress multiple files with UglifyJS?

Something like...

uglifyjs -o app.build.js appfile1.js appfile2.js ...

Also, I am running Uglify via NodeJS in Windows Command Prompt

Answer

Jakub picture Jakub · Jan 11, 2012

Actually what you want to do (trick it into thinking its just 1 file) is just cat it

Linux

cat file1.js file2.js file3.js file4.js | uglifyjs -o files.min.js

Windows (untested)

type file1.js file2.js > uglifyjs -o files.min.js

OR

type file1.js file2.js > merged.files.js
uglifyjs -o merged.files.js