-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blazor empty template doesn't load scoped CSS #43975
Comments
Thanks for contacting us. We're moving this issue to the |
Options we've discussed
|
Just my 2 cents, but I ran into this issue because I misread the following line in the docs.
My suggestion would be to make it:
|
The new empty template does not contain a tag like this in
index.html
:... and so, by default, scoped CSS is not loaded or applied. Obviously people can add this manually, but it's very nonobvious, and breaks many docs/tutorials that tell you that scoped CSS just works without further manual steps. For example you might add a reference to
QuickGrid
and expect its built-in styles to show up automatically, but they won't unless you add this hard-to-know-about tag.You could argue that this is by design because the "empty" template is, well, empty. But we have to strike a balance between emptiness and usability, and in this specific case, I think the surprisingness of this problem and the nonobviousness of the solution would land us on the side of wanting it to work by default.
Solution
This is a bit awkward to solve because we can't simply add that
<link>
tag to the template. Until your project contains some scoped CSS, you'd get a 404 for that file.Ideally we would serve an empty file rather than a 404, and then the template could contain the
<link>
tag by default. People who don't want to use scoped CSS at all can simply remove the tag.The text was updated successfully, but these errors were encountered: