| Page 1 of 1 | [ 6 posts ] |
|
So I've made lots of modules of my app and they all load automagically, fine.
What I don't quite like is that I have (to have???) lots of directories with one file each. For example, I do a Y.use('module-x', ...) so in the load path I have (to have?) ./module-x/module-x.js (How) can I get several related files into one directory? Similar question, (how) can I have sub-directories? I know I could add a configuration for all modules, just would like to know if that's my only option. |
|
Hey Michael,
You can define a group (with a prefix), which means that any module that you try to load with that prefix (aka my-module-x) will be loaded using a global configuration. http://developer.yahoo.com/yui/3/api/Lo ... d_addGroup A simple example will be: Code: YUI_config = { groups: { my: { base: '/my-local-modules/', // If you have a combo service, you can configure that as well // combine: true, // comboBase: 'http://myserver.com/combo?', // root: '/build/' } } }; // then YUI().use('my-module-x', function (Y) { // ready }; Best Regards, Caridy |
|
Oh I HAVE defined such a group of course, but that does not change the described problem
|
|
Hey Michael,
Defining the group give you a way to define patterns for your modules, changing the way the url for the module gets generated. Like this: Code: YUI_config = { groups: { my: { base: '/my-local-modules/', patterns: { 'my-submodule-': { configFn: function(me) { me.path = me.path.replace(/my-submodule/, 'my-submodules/my-submodule'); } } } } } }; So, basically, you can match the name of the module, and correct the full path (first argument "me") to generate the correct path for a particular module or a set of module. I think that's flexible enough to achieve your goal. Best Regards, Caridy |
|
Ah, that's useful! I didn't see (find???) that particular feature in the documentation. Thanks!
|
|
Here is the doc:
http://developer.yahoo.com/yui/3/api/Lo ... y_patterns A group supports the same set of properties that the global loader Best Regards, Caridy |
| Page 1 of 1 | [ 6 posts ] |
| 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 |
© YUI Library - Site Credits
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group