Combine multiple JavaScript files into one JS file

Chandrasekhar picture Chandrasekhar · Apr 1, 2011 · Viewed 173.3k times · Source

I am using jquery in my web application and I need to load more jquery script files into a single page.

Google suggested I combine all the jquery script files into a single file.

How can I do this?

Answer

dfsq picture dfsq · Sep 16, 2011

On linux you can use simple shell script https://github.com/dfsq/compressJS.sh to combine multiple javascript files into the single one. It makes use of the Closure Compiler online service so the resulting script is also effectively compressed.

$ ./compressJS.sh some-script.js another-sctipt.js onemore.js