Can I specify which scripts are loaded by Juice UI?

时光总嘲笑我的痴心妄想 提交于 2019-12-25 06:48:16

问题


I am using Juice UI within an ASP.NET application built with the Zurb Foundation framework. Foundation uses jquery.min.js (v 1.7.1) in the site masterpage. However, Juice UI also automatically loads a 1.7.1 script on the page whenever I use a control. Is it possible to configure Juice UI to skip loading just that script to avoid duplication?


回答1:


Juice UI uses the ScriptManager class for managing which scripts are added to the page. Any reference to Juice UI in your code on a page will tell ASP.NET that it needs to inject the referenced scripts. (The scripts are actually referenced in JuiceWidgetState.cs)

Have a look at https://github.com/appendto/juiceui/blob/master/Juice/JuiceApp.cs for a reference.

I haven't looked into a more elegant solution, but you could the ScriptManager class (or control) to reference jQuery in the master page, using the same key. When Juice UI is used, it'll only add it once that way.

If you devise another solution, please do contribute it to the project via a github gist or pull request!



来源:https://stackoverflow.com/questions/9741880/can-i-specify-which-scripts-are-loaded-by-juice-ui

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!