AMD Loader禁用,在主题中启用 [英] AMD Loader disable, enable in theme
问题描述
我遇到了AMD Loader的问题。
我想将bootstrap-slider.js和css绑定到应用程序中。所有的javascript和css都在主题中声明。现在滑块js与dojo js不协调。
我发现解释和 XSnippet von Ferry Kranenburg。在自定义控件中,代码非常好。但是我希望所有应用程序都能在主题中使用。
但它不起作用。我可以禁用,在主题中启用AMD Loader吗?
I have a problem with the AMD Loader. I want bind the bootstrap-slider.js and the css into the application. All the javascript and css are declare in a theme. Now the slider js don't harmonize with the dojo js. I found the explains from Marky Roden and the XSnippet von Ferry Kranenburg. In the custom control the code is very good. But I want all that in the theme for all the application. But it don't work. Can I disable, enable the AMD Loader in a theme?
推荐答案
我认为这是可能的。创建2个额外的JavaScript文件:
I think that's possible. Create 2 additional JavaScript files:
disable_amd.js
,包含以下内容:
if (typeof define === 'function' && define.amd) {if(define.amd.vendor =='dojotoolkit.org'){define._amd = define.amd;delete define.amd;}}
和
enable_amd.js
包含以下内容:
if (typeof define === 'function' && define._amd) {define.amd = define._amd; delete define._amd;}
在加载 bootstrap-之前加载第一个slider.js
JavaScript文件(将其放在上面),然后是第二个。
Load the first one before you load bootstrap-slider.js
JavaScript file (place it above that) and the second one afterwards.
这篇关于AMD Loader禁用,在主题中启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!