Using Requirejs in Javascript

Joined
Feb 16, 2011
Messages
1
Reaction score
0
Hi,

I am using requirejs in my js files.
If I have 3 pages and each page depends on more than one js files.For each page I have a master js file and in that I am specifying the other scripts to be loaded.
For Example:

Master1.js will have
define(["abc","jquery-pubsub","x"],function(){ Here I will write my code}

Master2.js will have
define(["xyz","jquery-ElementValidator","y"],function(){ Here I will write my code}

Master3.js will have
define(["wpx","jquery-Printelement","dff"],function(){ Here I will write my code}


My Question is

I want to centralize the code where in all the define() are placed, so that I can avoid each developer doing that page, worry about the order and what scripts to be loaded. I have any new scripts, I can just go the central location and add the scripts pertinent to the page.

Ex: If I have a master page, I should be able specify the scripts to be loaded for each page when the page is loaded, instead of loading all the scripts at time.

Any idea is highly appreciated,
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top