Closed (fixed)
Project:
Glisseo
Version:
2.0.0-alpha2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Apr 2022 at 13:17 UTC
Updated:
29 Apr 2022 at 11:49 UTC
Jump to comment: Most recent
New Drupal install (9.3.11) with nothing but Glisseo, a new sub theme and Twig Tweak enabled.
Trying a simple example by changing text color. For all screen sizes color remains green.
typography.pcss
p {
color: green;
@media (--md) {
color: red;
}
}
Compiled version in typography.css
p{color:green;@media (min-width:768px){color:red}}
Thanks
Comments
Comment #2
niklanThe
postcss-nestingplugin was removed because theme not used it (just a few places), but others in my experience heavily abuse that feature and make styles hard to support. So, it is more harmful than helpful.You have two options here:
Option #1
Use native "nesting", so you need to "unnest" your styles:
Option 2
Get back postcss-nesting plugin.
1. Require that dependency for theme
npm install postcss-nesting.2. Edit
THEME/scripts/css/postCssPlugins.js.3. Add
import postcssNesting from 'postcss-nesting';at the top of the file. Example.4. Add
postcssNesting(),inpostCssPluginsarray. Example.The result file will be (you can copy-paste it):
Then just re-run watch / compile script if it's running at this point. That's it. It will work as you expected, you can nest everything, including media queries.
Comment #3
hs@henrikstrindberg.se commentedMany thanks for this explanation!
Comment #4
hs@henrikstrindberg.se commentedHi!
The
grid.pcsshas a nested declaration of css-variables. It did not work for me. I changed it to the style of native nesting that you recommended and then it works:I changed it to:
Maybe another issue but I make it as a comment and question here. Thanks.
Comment #5
niklanYeah, I'm aware of it, faced it by myself. Will fix it :) Thank you. Let's use that issue to track this problem then.
Comment #7
niklanFix released with 2.0.0-alpha4