Group media queries
See original GitHub issueWhile the media query bubbling is great:
header {
color: green;
@media only screen (max-width: 500px) { color: red; }
}
footer {
color: green;
@media only screen (max-width: 500px) { color: red; }
}
Less generates fairly bloated code because it repeats the mediaquery selector each time its declared in the less file:
header {
color: green;
}
@media only screen (max-width: 500px) {
header {
color: red;
}
}
footer {
color: green;
}
@media only screen (max-width: 500px) {
footer {
color: red;
}
}
It would be nice if media queries could be grouped if they’re identical:
header {
color: green;
}
footer {
color: green;
}
@media only screen (max-width: 500px) {
header {
color: red;
}
footer {
color: red;
}
}
Issue Analytics
- State:
- Created 11 years ago
- Reactions:2
- Comments:64 (18 by maintainers)
Top Results From Across the Web
gulp-group-css-media-queries - npm
CSS postprocessing: group media queries. Useful for postprocessing preprocessed CSS files.. Latest version: 1.2.2, last published: 5 years ...
Read more >Is there an advantage in grouping css media queries together?
Yeah profiles. Run CSS Selectors and you will get a profile of how long things take to run. Try this with group queries...
Read more >Using media queries - CSS: Cascading Style Sheets | MDN
Media queries allow you to apply CSS styles depending on a device's general type (such as print vs. screen) or other characteristics such...
Read more >A Complete Guide to CSS Media Queries
CSS Media queries are a way to target browser by certain characteristics, features, and user preferences, then apply styles based on those ...
Read more >gulp-group-css-media-queries - npm package - Snyk
CSS postprocessing: group media queries. Useful for postprocessing preprocessed CSS files. This plugin is a wrapper for the group-css-media-queries plugin.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing since this is supported by a plugin, and isn’t a priority to move into core (AFAIK - @less/admin correct if this is wrong).
IMO it makes sense to generalize the problem to scope grouping control which will provide solution for issue #930