我正在使用 grails 资源 1.1.6,并且我能够从外部主机加载库,例如通过执行以下操作:
modules = {
jquery_cdn {
resource(disposition: "head", url:'js/jquery.mobile-1.7.1.js', linkOverride:'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js')
}
[..]
}
但是,一旦我在这里添加 jquery-ui,它就会停止工作并从当前主机解析文件。
modules = {
jquery_cdn {
resource(disposition: "head", url:'js/jquery.mobile-1.7.1.js', linkOverride:'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js')
resource(disposition: "head", url:'js/something', linkOverride:'http://anything')
}
[..]
}
这会导致:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript" ></script>
<script src="/static/XMKHDE4MFb89NXoDjkyRQnfxc1eyN63e6j43EEfPshE.js" type="text/javascript" ></script>
我到底做错了什么?
最佳答案
您正在寻找这样的东西吗?
modules = {
...
streetmap {
resource url: 'http://www.openlayers.org/api/OpenLayers.js', disposition: 'head'
resource url:'js/streetmap.js'
}
...
}
其中 js/streetmap.js 包含我的附加功能
关于jquery - 从 CDN 加载 JQuery 和 JQuery UI 等资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9351594/