Changing dependency of WebSharper.JQueryUI to load

2019-08-07 19:41发布

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条回答
男人必须洒脱
2楼-- · 2019-08-07 20:14

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.

查看更多
登录 后发表回答