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
Minification is just removing unnecesary whitespace and redundant / optional tokens like curlys and semicolons, and can be reversed by using a linter. Uglification is the act of transforming the code into an "unreadable" form, that is, renaming variables/functions to hide the original intent...
To 'uglify' a JavaScript file is to minify it using Uglify. Uglification improves performance while reducing readability.
What is UglifyJS? # UglifyJS is best known as a JavaScript minifier. Minification is a valuable performance enhancing technique as it removes whitespace and unnecessary characters within a file to make it smaller and thus, load faster.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With