Loading ...
Sorry, an error occurred while loading the content.

920Re: [yui3] Adding a bunch of external modules

Expand Messages
  • Lucas Smith
    Sep 25, 2009
    • 0 Attachment
      You could try something like this
      YUI.add('myapp.loader-meta', function (Y) {
          Y.mix(Y.config.modules, {
              'myapp.module-a': { fullpath: ... },
              'myapp.module-b': { fullpath: ... },
              'myapp.module-c': { fullpath: ... }
          });
      }, '3.0.0beta1');

      then in your implementation code
      YUI({
          modules: {
              'myapp.loader-meta', { fullpath: '/path/to/that-up-there.js' }
          }
      }).use('myapp.loader-meta', function (Y) {
          // All your module info is available for use(..) now

          Y.use('myapp.module-a', 'myapp.module-c', function (Y) {
              // implementation code
          });
      });

      Or you can create a custom rollup for your modules in one file, then include a special rollup module name at the end
      YUI.add('myapp.module-a', function (Y) { ... }, ver, config);
      YUI.add('myapp.module-b', function (Y) { ... }, ver, config);
      YUI.add('myapp.module-c', function (Y) { ... }, ver, config);
      YUI.add('myapp.all-modules', function (Y) {}, '3.0.0beta1', { use: [ 'myapp.module-a', 'myapp.module-b', 'myapp.module-c' ] });

      then in your implementation code
      YUI({
          modules: {
              "myapp.all-modules": { fullpath: '/path/to/rollup.js', requires: [ /* all requirements from all rolled up modules */ ] }
          }
      }).use('myapp.all-modules', function (Y) {
          // modules a-c are present
      });

      Hope this helps,
      Luke


      On Sep 25, 2009, at 1:50 PM, Andrew wrote:

      I want to add a number of modules and dependencies to the Loader so that I don't have to include all of my own JS files above my call to YUI().use("" , function(Y) {}). It seems like you need to pass this as part of the argument to the call of YUI(), which is inconvenient.

      I'd like to declare them as default modules for my product or something like that. Anyway to make that happen?


    • Show all 2 messages in this topic