Skip to content

css isolation compiler warnings for incorrect css syntax #41751

@AMUCOMO

Description

@AMUCOMO

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I'm working on a server-side Blazor project. I use many components (.razor files) with their corresponding css isoltation (.razor.css) files. I noticed a bug where the first css-class ".my-class {color: blue;}" of one specific component's isolated css file (B.razor.css) was not displayed. I noticed renaming the component and its .css file did change/move/disable the bug. Cause was, that A.razor.css had one too many "}" at the end of the file. Thus, after the compiler combined all isolated css files, ofc the following class after the bad "}" did not work correctly (meaning the browser did not show the color, just as if .my-class was not existing). It took me hours to find, because the cause (the "}" ) was in A.razor.css but the effect was seen in B.razor.css, so naturally I looked at B.razor.css for hours. If I renamed B.razor.css (and its comp) to D.razor.css (and its comp) then the first class of C.razor.css was not working.

These are example names, actually my class was named differently, and starting with letter S, but I noticed it worked if I renamed it to anything not starting with S. That was very confusing.

I hope you understand the issue.
If it's not clear enough, please add a comment, then I will try to provide more information and data.

Describe the solution you'd like

Please add a compiler warning, so that VS will notify me if the syntax of my .css files is incorrect. So a faulty css file would be found much quicker. Especially, since the framework will combine all of the .razor.css files into once single css file, it should actually check if each .razor.css file on its own is syntactically correct, so that no one file can influence/corrupt the behavior of another.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions