You will need an initial document else you wouldn't have the <script> tag that loads the code to run. If you just want to save that extra div you can do:

1
2
3
4
5
6
7
8
open WebSharper.JavaScript

let Main =
	let body : Dom.Element = JS.Document?body
    
    div []
    |> Doc.Run body
By on 3/30/2016 9:55 AM ()

I am surprise there isn't a default value for the initial Html document and holes for it's parts, perhaps as an extension to the Templating module. The need to establish a separate cookie-cutter file in the project just for that purpose seems tedious. Perhaps something like this would be useful in general.

1
2
3
4
5
6
7
8
9
10
11
module HtmlPage =
  type Descriptor = {
  	title   : string option
    ...
    body    : Doc option
    }
    with
    static member Default : Descriptor = ...
    static member Mobile  : Descriptor = ...
    
  let createPage (desc:Descriptor) : string = ...
By on 3/30/2016 2:24 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper