2011-11-04 46 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){ 
    // ... 
}); 
相關問題