Changing dependency of WebSharper.JQueryUI to load jquery-ui.js locally

落花浮王杯 提交于 2020-01-05 21:14:27

问题


I'm writing on a WebSharper sitelet that uses the JQueryUI extension. The HTML generated by the WebSharper sitelet looks like this:

<html>
  <head>
    ...
    <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js" ...></script>

I'm frequently without internet while developing, so I'd really like to serve jquery-ui.js off the development server instead. That is, I'd much rather have this:

<html>
  <head>
    ...
    <script src="/Scripts/jquery-ui.js" ...></script>

The docs say this should be possible by setting an appropriate appSetting in Web.config, but no value I set for the keys listed in the docs seem to have any effect on the output.

I'm using (NuGet versions) WebSharper 3.0.54.140 and WebSharper.JQueryUI 3.0.45.241.

How do I force WebSharper to output a link to a resource local to the server?


回答1:


Indeed there is an error in the documentation. The key to use is the fully qualified name of the resource type, so for WebSharper.JQueryUI it should be:

<appSettings>
  <add key="WebSharper.JQueryUI.Dependencies+JQueryUIJs" value="/Scripts/jquery-ui.js" />
  <add key="WebSharper.JQueryUI.Dependencies+JQueryUICss" value="/Content/jquery-ui.css" />
</appSettings>

Edit: just fixed the documentation.



来源:https://stackoverflow.com/questions/30076131/changing-dependency-of-websharper-jqueryui-to-load-jquery-ui-js-locally

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