aspnetcore
aspnetcore copied to clipboard
Blazor component structure
Hello!
Is it possible to build an Blazor component with separating C# component stuff (@functions {}), html and css files?
Something similar we have in Angular framework.
Structure:

Usage from .ts:

You can put your C# code into a normal class that inherits from BlazorComponent, and then make your .cshtml inherit from that using the directive;
@inherits MyOtherClass
Some people call this the "code behind" pattern.
We don't yet have any built-in way of combining multiple CSS files, so for now if you want to do that, you'll need to set up something like a WebPack configuration of your own.
@SteveSandersonMS nice, thanks!