aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Blazor component structure

Open rostykode opened this issue 8 years ago • 2 comments

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: firefox_2018-10-08_16-04-06

Usage from .ts: firefox_2018-10-08_16-04-19

rostykode avatar Oct 08 '18 13:10 rostykode

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 avatar Oct 08 '18 13:10 SteveSandersonMS

@SteveSandersonMS nice, thanks!

rostykode avatar Oct 08 '18 13:10 rostykode