Bolero icon indicating copy to clipboard operation
Bolero copied to clipboard

Is it possible to use the HTML Type Provider Outside of Bolero?

Open bytesource opened this issue 2 years ago • 3 comments

Hi,

I'm bad at designs. The HTML type provider would allow me to buy a nice-looking HTML template and use it with the power of F#.

The problem is, outside of Bolero, view engines like Felix seem to be the norm at the moment.

Therefore, I'd like to ask if it is possible to use the HTML provider in other projects too? Is it available as a standalone package or tied to Bolero?

Cheers,

Stefan

bytesource avatar Jul 19 '21 02:07 bytesource

I have a similar question. I want to use the html template type provider, fill in the holes, (or functions) and then output the html and write it to disk. Is this possible already? Which references are needed and what function would do the final render to html?

IvanRainbolt avatar Apr 14 '23 16:04 IvanRainbolt

How do you want to "fill the holes"? Just statically? Why then not just write html? If you want to fill them dynamically, you need the runtime environment. Or am I misreading your question?

Martin521 avatar Apr 15 '23 09:04 Martin521

It could be useful for static site generation. After all, Bolero's own website uses WebSharper's similar template system.

This is essentially possible since Bolero 0.21, which added the function Bolero.Server.Components.Rendering.renderPlain : Node -> string. You do have to reference Bolero, and use Blazor's renderer behind the scenes, just to generate static HTML, which definitely feels overkill if it's in a project that is not otherwise using Bolero. But it's not really possible to disentangle the templating provider from Bolero, because it needs to provide Bolero-specific code for things like event handlers and data binding. In this way it's similar to Feliz, which can only be used in the context of React.

Tarmil avatar Apr 15 '23 10:04 Tarmil