Closed thinkbeforecoding closed 5 years ago
The goal is then to use this as a F# template engine for FSharp.Formatting for instance.
This looks like a great a addition and should expand the possibilities of SSR as you said. As the API is maintained I don't see any problem to merge it, but if @zaaack, as the SSR part author, and @forki, who has been using it, can have a look that would very helpful.
@thinkbeforecoding Great job!
Just pulled and tried with the SSRSample app, updated the fable version. here is the pr: https://github.com/thinkbeforecoding/fable-react/pull/1
Does it keep its perf characteristics?
@thinkb4coding if I understand correctly this can be used to convert a fable react site into a mostly static site, right? Here is a thought: our conference site which is built from https://github.com/fable-compiler/fableconf lacks good SEO. I always thought about putting it in SSR mode, but we don't have a proper Webserver set up for it. It's just github pages. If you are interested it would be awesome if you try your new tool on that project
I use this tecnic for my blog:
It's hosted on azure functions but there are actually no functions. Just proxy rules to forward blobs that have been staticaly generated using Fsharp.Formatting for content and fable-react renderToString for templating.
So yes, doing it for this site is doable
I merged the PR from @zaaack
would there be a better way to mark the difference between renderToString that adds the reactroot attribute and the writeTo that doesn't ?
It could be possible to put the writeTo in a sub module to show it's more lowlevel stuff but could not find a good name.. so I let it there...
Thank you all! I merged the PR, but you're right @thinkbeforecoding, it may be better to add more semantics to the difference between renderToString
and writeTo
, I'll think of something.
@forki Actually the fable.io site is generated statically (unlike fableconf web which was created before) but I had to use a node server, this will allow faster iterations and using familiar IO commands from .NET. Thank you again @thinkbeforecoding!
When do you think the nuget will be released ?
When do you think the nuget will be released ?
I love your polite way to say: "Publish a nuget release NOW!!" :wink: Ok, I pushed Fable.React 4.1.1. As you suggested I put writeTo
in a submodule named Raw
to enforce the semantics and added a comment to make it clear the reactroot
attribute is not added in that case :+1:
Perfect ! 😄 Thx !!
I extracted the
render
function to provide it as a publicwriteTo
that writes to a TextWriter.The renterToString is now using a
StringWriter
which uses aStringBuilder
internally, but for templating purpose, it is possible to use writeTo directly on aStreamWriter
to write directly to files or network streams.