问题
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