Aramid: Create Strongly-Typed HTML Components in C#
github.com
github.com
H.head ( H.title ("Hello world"), H.link (a => a.href ("/favicon.ico").rel ("shortcut icon").type ("image/x-icon")) )
Having used it on a website that I've had to maintain for years I can say that the simplicity of writing reusable components and ease of refactoring is really nice. It entirely negates the need to use a view mechanism at all - you just write your views in C# code.
The links for github and nuget are:
https://github.com/hyperlinq/hyperlinq https://www.nuget.org/packages/Hyperlinq
I should mention that I use Hyperlinq in conjunction with MarkdownDeep. Markdown is great for defining HTML fragments that are very document-oriented, as opposed to data-oriented. So for instance I'd use markdown to define an FAQ, but would use Hyperlinq to define HTML for a customer record. Markdown fragments can be inserted into a Hyperlinq DOM as literal nodes (the underlying mechanism for Hyperlinq is Linq to XML), so the two approaches mesh together nicely.
I wrote the library ages ago but put very little effort into promoting it as I'm too busy.
https://github.com/intellifactory/websharper.ui.next/blob/ma...
https://kimsereyblog.blogspot.co.uk/2016/08/create-html-comp...
Some languages can work around this by having flexible type definitions and syntax to make the DSL much closer to the target template (for an example, see: http://www.lihaoyi.com/scalatags/). This works pretty well to avoid all those field declaration and "new" keywords.
I agree, but it's not that bad. I do think j2html [1] has a cleaner look than Aramid.