Open davidhirtz opened 3 years ago
Is it a specific order or we may to sort it somehow? I don't know actually how to handle it except option to sort media or specify an order of queries.
For most use cases I think a mobile first approach would be best (or the option to reverse it) for sorting. Lowest min-with, max-width, min-height, and max-height to highest, if this is even possible? Let me know if I should provide more examples and thank you for the consideration! :)
Yeah, examples would be helpful! I thought that sorting by min/max-width/height might be a good option. We may implement it in the future, but currently no good "parser" for media queries, so it might be problematic.
You might want to take a look at this plugin, it has a semi-optimal sort option: https://github.com/hail2u/node-css-mqpacker
I would love to have an option to define the media query order when the
forceMediaMerge
istrue
. Currently I setup all media queries on the top of the CSS with an unused element in the order I need (for example mobile first):This is an ok solution but it creates unnecessary declarations. I tried to create empty media queries with
/*! ... */
comments, but those get stripped inside media queries even withcomments
settrue
and thus will not preserve the correct order.Is there a better solution? Thank you very much!