Add Razor Syntax Support Directly in C# Files for Improved Developer Experience #7532
Replies: 3 comments 10 replies
-
That looks like an API and a tooling request? I don't see any changes to C# syntax there. The Razor syntax appears to be embedded in a string literal. |
Beta Was this translation helpful? Give feedback.
-
@Nairda015 It seems like you want to create a new web framework/lib on top of AspNetCore but nothing about the language or the compiler should change so this discussion should probably be discussed elsewhere. If you do want to use razor components then this is already possible just not exactly the way you depict it in your post, it's also possible to use a SG to construct Blazor components based the pattern you propose in your post even though I can't see why it's better/beneficial than existing solutions. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/DamianEdwards/RazorSlices/blob/main/samples/RazorSlices.Samples.WebApp/Program.cs |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I have an idea to simplify workflow with Razor and minimal API to create a similar experience to the BETH stack in js land:
https://github.com/ethanniser/the-beth-stack/blob/main/src/index.tsx
Maybe this will encourage new people to use c# for frontend stuff more than Blazor itself? It will also merge nicely with the Minimal API ideology of simplifying the starting journey with .NET.
Basic example:
Reusing existing razor components here also will be a nice touch.
Maybe an extension method for adding HTMX headers will be also a good idea (currently I can't add an extension method to TypedResults because it is a static class)
Similar topics but different needs:
Returning razor components from C#
JSX support
Alternatives:
Beta Was this translation helpful? Give feedback.
All reactions