Home > front end >  Blazor static content in F# library
Blazor static content in F# library

Time:02-10

Blazor (WASM) supports libraries containing javascript (besides other static contents and components).

Javascript files can be referenced with standard <script> elements in the index.html page of the main project

/_content/<library>/<path>/<file.js>

where <path>/<file.js> must be located under the wwwroot folder of the library project.

What if my library is F# instead of C#? We can write components in F# (of course all in .fs files, no .razor), but what if I want also to put javascript specific to the component in the same F# project?

BTW similar question would apply to .css

Please note:

  • javascript and css isolation are available in C#. It would be handy to be able to do it also in a F# component library.
  • I know there is Bolero for F# and Blazor, In this case I am not going to use Bolero.

CodePudding user response:

  •  Tags:  
  • Related