Support for PostCSS nested rules

HI! I'd like to use nested CSS rules in CSS files with the PostCSS Nested plugin. It works and compiles fine, but the syntax checker marks nested rules as an error.

 

I have installed the PostCSS plugin and changed my Project CSS Dialect to 'PostCSS'. I think I read that should do the trick, but unfortunately it still says my code is wrong.

Any ideas on how to use nested rules without errors and full support for it?

0

Hi there,

Works fine here.

PhpStorm 2021.2 with PostCSS plugin by JetBrains.

Checked in a file with .pcss extension (so it's automatically treated as PostCSS) as well as .css and manually set that file to be PostCSS.

Files:

PostCSS settings:

The test file content (just in case):

main {
height: 400px;
width: 100%;
section {
width: 60%;
height: 50px;
border: 2px solid black;
}
}

.component {
&.modifier {
color: red;
}
}
2

Try my test file -- does it work for you?

If it works: it could be your file (something that IDE does not understand there). Can you share it? (as a link so it can be downloaded in full).

0

Yes, it now works fine now. Perhaps I did set a wrong path. Had previously set not the file itself, but the project root path. This should work as well, right? Or do I have to select files individually? 

0

If you set "Project CSS Dialect" to be PostCSS then yes, it should work.

This works for me (now and earlier today when was checking all that).

2

请先登录再写评论。