2011-11-04 49 views
0

这是一个理论问题。RequireJS如何与Joomla这样的系统一起使用?

如何将RequireJS可与系统中使用如Joomla目录结构(包括包括组件,插件脚本的能力等)

/components/com_something/script/a.js 
/components/com_other/script/b.js 

或者是不适合这种多RequireJS分层的目录结构?

回答

3

您可以使用路径配置:

require.config({ 
    baseUrl: '/components' 
    paths: { 
    something: 'com_something/script', 
    other: 'com_other/script' 
    } 
}); 

require(['something/a', 'other/b'], function(a, b){ 
    // ... 
});