Is it possible to use websharper as a drop-in replacement for javascript without the additional complexity of sitelets or ASP.NET?
For example, can I compile the following websharper library to a .js file and call the hello() function from within a javascript script block in my html?
namespace WebSharperLib
open IntelliFactory.WebSharper
module HelloWorld =
[<JavaScript>]
let hello () =
IntelliFactory.WebSharper.JavaScript.Alert("Hello World")
You can indeed do something like that. The solution i found is as following :
Copy the last line of the solution generation (where it runs websharper) and run it in powershell/console just adding the option
-js name of your js file
The thing is, this way you don't have any of the compiled dependencies. I guess you can get them if you make a full project and go grab the compiled js output there.
Tt seems to me WebSharper is not made to be used this way, but rather as a full package.
If you just want F# compilation to Javascript, there is Pit that is made exactly for that purpose, so i suggest you try that first.