You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Blazor we have the ability to create scoped CSS files by ending the file in .razor.css.
For example a component named MyComponent.razor can have a isolated CSS file MyComponent.razor.css.
More details here.
This feature fits nicely when one creates components with a code-behind file (e.g. MyComponent.razor.cs).
But it feels odd when using the @code directive, so everything is grouped in a single file.
Therefore, I suggest a complementary @style directive which in essence behaves in the same way the isolated CSS files do. Meaning the code within should be bundled the same way and also respect DisableScopedCssBundling and ScopedCssEnabled project settings.
I have not looked into the inner workings of Razor and do not know how the compilation and bundling works in detail. However a naive solution could be to just emit the CSS in the @style directive as scoped files and then just use the existing bundling logic.
The text was updated successfully, but these errors were encountered:
In Blazor we have the ability to create scoped CSS files by ending the file in
.razor.css
.For example a component named
MyComponent.razor
can have a isolated CSS fileMyComponent.razor.css
.More details here.
This feature fits nicely when one creates components with a code-behind file (e.g.
MyComponent.razor.cs
).But it feels odd when using the
@code
directive, so everything is grouped in a single file.Therefore, I suggest a complementary
@style
directive which in essence behaves in the same way the isolated CSS files do. Meaning the code within should be bundled the same way and also respectDisableScopedCssBundling
andScopedCssEnabled
project settings.I have not looked into the inner workings of Razor and do not know how the compilation and bundling works in detail. However a naive solution could be to just emit the CSS in the
@style
directive as scoped files and then just use the existing bundling logic.The text was updated successfully, but these errors were encountered: