WebSharper
By Loïc Denuzière on Monday, November 23, 2015 — 2 comments

WebSharper 3.6 released with CDN supportCore team

We are happy to announce the release of WebSharper 3.6.

The main new feature is the capability to point to our CDNs for the WebSharper libraries. You can simply add the following setting to your application configuration file (Web.config or App.config depending on the project type):

1
2
3
<appSettings>
  <add key="WebSharper.StdlibUseCdn" value="true" />
</appSettings>

The links generated by WebSharper, instead of pointing to /Scripts/WebSharper/... for scripts and /Content/WebSharper/... for CSS, will point to //cdn.websharper.com/{assembly}/{version}/{filename}. You can configure this URL by setting the WebSharper.StdlibCdnFormat configuration setting. And finally, you can configure the CDN URL for the resources of a specific assembly (from the standard WebSharper library or not) by setting the WebSharper.CdnFormat.{assemblyname} configuration setting.

Here is the full change log:

  • #488: Allow adding a macro attribute on a type. The macro is invoked for all static and instance method calls on this type.

  • Fix issue preventing macro use in argument to a PropertyGet/Set.

  • #490: Retrieve appConfig parameters from Web.config or App.config when building a single-page application.

  • #493: Add WebSharperReference project item. This allows you to pass references to the WebSharper compiler that are not referenced by the compiled assembly. For example, adding the following to your project file:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    <ItemGroup>
      <WebSharperReference Include="..\packages\WebSharper.3.6.2.220\lib\net40\WebSharper.Core.dll" />
      <WebSharperReference Include="..\packages\WebSharper.3.6.2.220\lib\net40\WebSharper.Core.JavaScript.dll" />
      <WebSharperReference Include="..\packages\WebSharper.3.6.2.220\lib\net40\WebSharper.JavaScript.dll" />
      <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.JQuery.dll" />
      <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.Main.dll" />
      <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.Control.dll" />
      <WebSharperReference Include="..\packages\WebSharper.3.5.2.220\lib\net40\WebSharper.Collections.dll" />
    </ItemGroup>

    and removing the corresponding <Reference> entries allows you to use the proxies from the standard libraries without referencing them in your assembly.

  • Add AssemblyFileVersionAttribute to all standard library assemblies.

  • #494: Add support for pointing resources to a CDN (see above).

  • #495: Add proxies for {Int32,Double,DateTime}.{MinValue,MaxValue}.

  • #496: Add proxy for String.IsNullOrWhiteSpace.

Happy coding!

  • Vasily Kirichenko

    I'm not a web dev guru, so I don't understand why using scripts from CDN is faster than from local folder. Could you explain, please?

    • loic.denuziere

      The main reason is that CDNs have replication all over the world, so even though your website is hosted in a given location, the scripts will be served from a nearby server for every user around the world and therefore they will load faster. Also, if someone visits several websites that use the same version of WebSharper then the scripts will already be cached in their browser.