[ 4 posts ]

vysun

  • Joined: Thu Jun 11, 2009 5:26 am
  • Posts: 71
  • Offline
  • Profile

YUI Load mutiple JS In fullpath

Post Posted: Mon Aug 08, 2011 6:39 am
+0-
I have used following code to load multiple JS, it seems doesn't work at all. any suggestion how to load multiple JS on the single model.

YUI({

fullpath: 'myfile1.js myfile2.js ...'
}).use('f1','f2', function(Y) {

});

Thanks.

Vincent

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: YUI Load mutiple JS In fullpath

Post Posted: Mon Aug 08, 2011 6:59 am
+0-
Hey Vincent!

You need to declare each module in the "modules" property of the YUI configuration.
Code:
YUI({
  modules: {
    'f1': {
      fullpath: 'myfile1.js'
    },
    'f2': {
      fullpath: 'myfile2.js'
    }
  }
}).use('f1', 'f2);

There are multiple ways of structuring your project files. Check out the Loader documentation for more info!

vysun

  • Joined: Thu Jun 11, 2009 5:26 am
  • Posts: 71
  • Offline
  • Profile
Tags:

Re: YUI Load mutiple JS In fullpath

Post Posted: Mon Aug 08, 2011 7:05 am
+0-
It is possible, has a single module to load multiple js. I have a lot of not YUI3 existing JS code.
YUI({
modules: {
'f1': {
fullpath: 'myfile1.js, myfile2.js, myfile3.js...'
},
'f2': {
fullpath: 'myfile4.js'
}
}
}).use('f1', 'f2');

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: YUI Load mutiple JS In fullpath

Post Posted: Mon Aug 08, 2011 7:08 am
+0-
No exactly, but you can define dependencies for one module and have that one require all the others you need, so effectively you just use() one module and load all the others.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum