[英]How could RequireJS be used with a system like Joomla?
This is a theoretical question. 这是一个理论问题。
How would RequireJS be used with a system like Joomla with the directory structure (including ability to include scripts from components, plugins, etc) RequireJS如何与具有目录结构的Joomla这样的系统一起使用(包括包含来自组件,插件等的脚本的功能)
/components/com_something/script/a.js
/components/com_other/script/b.js
Or isn't RequireJS suitable for this kind of multi-tiered directory structure? 还是RequireJS不适合这种多层目录结构?
You can use paths config: 您可以使用路径配置:
require.config({
baseUrl: '/components'
paths: {
something: 'com_something/script',
other: 'com_other/script'
}
});
require(['something/a', 'other/b'], function(a, b){
// ...
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.