Comments (6)
Hi @yunusga, I also have a repro of this issue: https://codesandbox.io/s/postcss-forked-vw07gs?file=/src/index.js:102-192.
Input:
@supports(container-type:inline-size) {
@media(min-width: 300px) {
color: red;
}
}
Output:
@supports(container-type:inline-size) {
}
@media (min-width: 300px) {
color: red
}
Expected output (same as input):
@supports(container-type:inline-size) {
@media(min-width: 300px) {
color: red;
}
}
from postcss-sort-media-queries.
I can confirm this is an issue. Here is the code example where the sorting logic fails:
@custom-media --breakpoint-sm (min-width: 600px);
@custom-media --hover-check (hover: hover);
.link {
color: blue;
@media (--hover-check) {
&:hover {
color: red;
}
}
@media (--breakpoint-sm) {
color: green;
@media (--hover-check) {
&:hover {
color: pink;
}
}
}
}
Which results to:
.link {
color: blue;
}
@media (min-width: 600px){
.link {
color: green
}
@media (hover: hover) {
.link:hover {
color: pink;
}
}
}
@media (hover: hover){
.link:hover {
color: red;
}
.link:hover {
color: pink;
}
}
Instead of:
.link {
color: blue;
}
@media (hover: hover) {
.link:hover {
color: red;
}
}
@media (min-width: 600px) {
.link {
color: green
}
@media (hover: hover) {
.link:hover {
color: pink;
}
}
}
from postcss-sort-media-queries.
@iamskok need your configuration because i have different result for your example without sorting
@media (min-width: 600px) and (hover: hover)
Result without sorting
.link {
color: blue;
}
@media (hover: hover) {
.link:hover {
color: red;
}
}
@media (min-width: 600px) {
.link {
color: green;
}
}
@media (min-width: 600px) and (hover: hover) {
.link:hover {
color: pink;
}
}
from postcss-sort-media-queries.
Hi @jimmy-guo, thanks, yes, that's right, I am aware of this problem, I will add an update soon. I didn't do this functionality because Firefox still doesn't support it https://caniuse.com/css-nesting
from postcss-sort-media-queries.
Linked issue OlehDutchenko/sort-css-media-queries#24
from postcss-sort-media-queries.
@iamskok, @jimmy-guo, @pavel-klimov I added quick fix for problem with ejected nested media queries postcss-sort-media-queries/blob/v5.2.0/README.md#only-top-level
from postcss-sort-media-queries.
Related Issues (10)
- Sort parameter issue HOT 4
- Compatibility with PostCSS 8 HOT 6
- Combine from different files? HOT 1
- not able to sort fonts correctly HOT 4
- Unexpected result (with postcss-nested 5.0.2+) HOT 3
- Cannot set property 'parent' of undefined HOT 8
- Recognize media types in query
- Update dependency "sort-css-media-queries" HOT 1
- Support range notation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postcss-sort-media-queries.