Mirage
Mirage

Reputation: 31548

Can i combine many js javascript files in one file

I am using jquery fileupload plugin and it has 7-8 js files which it loads. Now others developers are also working on site and sometime it cause confusion and difficult to find which js file is used where.

So i am thinking if i can combine 7 files in one file so that i can know that thats my file

Upvotes: 0

Views: 231

Answers (3)

Alberto Arena
Alberto Arena

Reputation: 343

I use Rake to compile Javascript (and SASS to CSS, as well). It minifies the files in a unique JS. It's written in Ruby, but it's easy to configure and it works very fine.

But if more developers are working on the same code, another good idea I strongly suggest is to to use a SVN (sub-version control system), as TortoiseSVN or Git. This will allow many developers to work on the same source files, without losing any change.

Upvotes: 0

Simon
Simon

Reputation: 3717

While possibly overkill in this particular case, it might be worth checking out grunt. It will let you keep your files divided into multiple files for when you are working on them, and as soon as any file change compiling, minifying and combining them into a single/groups of files as desired, while also allowing you to define the load order of your code.

It requires some setup the first time you run it (which you can later use as a template) but greatly improves the process of combining/minifying files, and also has support for processing coffescript and sass among others, as well as writing unit tests for your code.

Upvotes: 0

Niks Jain
Niks Jain

Reputation: 1647

Try this to compile your javascript file or code.

http://closure-compiler.appspot.com

Upvotes: 1

Related Questions