This is in response to issue #231, which calls for a nicer way to declare the doctype.
The old way of rendering HTML directly, which is to say not via the virtual dom, for the purposes of SSR or another JVM html use case, was to do something like this:
val includeDocType = true
val model = Int
val view = (i: Int) => html(p("count was " + i))
TyrianSSR.render(includeDocType, model, view)
Mostly ok, kinda, except that includeDocType is just a boolean, and I was quite taken by ScalaTags approach of just letting you prefix a string so that the doctype could be whatever you wanted.
So I took out includeDocType, and while wondering what do do next, I organised the render extensions methods, then I realised that asking someone to supply the view and the model, just so that I could call view(model).render for them in a clunky way via TyrianSSR.render was daft.
This is in response to issue #231, which calls for a nicer way to declare the doctype.
The old way of rendering HTML directly, which is to say not via the virtual dom, for the purposes of SSR or another JVM html use case, was to do something like this:
Mostly ok, kinda, except that
includeDocType
is just a boolean, and I was quite taken by ScalaTags approach of just letting you prefix a string so that the doctype could be whatever you wanted.So I took out
includeDocType
, and while wondering what do do next, I organised therender
extensions methods, then I realised that asking someone to supply theview
and themodel
, just so that I could callview(model).render
for them in a clunky way viaTyrianSSR.render
was daft.So now you just do any of these, and you're done:
What about the doctype?! Well... it's just a string you prefix to your rendered HTML. Do you need me for that? :thinking:
I have provided a constant for the default...