user996142
user996142

Reputation: 2883

Javascript compiler / dependency manager?

I have many JS files. Some of them depend on each other. Many of them depend on jQuery. I need tool that can accept one file as parameter, fetch all its dependencies transitively and compile them into one file in proper order (based on dependencies)

Dependency information not always available inside files itself, so it would be nice to have it somewhere outside (xml file? folder structure?)

I've heard about Yahoo JS compiler, closure and so on, but I am not sure they do what I need.

Look: I have module "CustomerPage". It sould include "validation.js" and "gui.js". Both require jquery.js. And "gui.js" also requires "myFunctions.js".

I want some ant task or some script that would generate "CustomerPage.js" as result of all that files.

Tool should check dependency order, prevent double including and so on.

My project could have around 500 js files, how could I live with out of this tool? People says "use GWT", but I need plain JS.

Upvotes: 0

Views: 209

Answers (1)

Scott Sauyet
Scott Sauyet

Reputation: 50807

You might want to look at one of the AMD-style module loaders, such as RequireJS. Some of these can do what you want for precompiling, and can run in a development mode which makes it easier to debug by including all the files directly.

Upvotes: 2

Related Questions