
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
sort-css-media-queries
Advanced tools
The custom `sort` method for `css-mqpacker` or `pleeease` (which uses css-mqpacker) or, perhaps, something else ))
The sort-css-media-queries npm package is designed to help developers sort CSS media queries in a specific order. This can be particularly useful for ensuring that media queries are applied in the correct sequence, which can help avoid issues with CSS specificity and cascading.
Sort Media Queries
This feature allows you to sort an array of CSS media queries in a specific order. The code sample demonstrates how to use the sort-css-media-queries package to sort an array of media queries.
const sortCSSmq = require('sort-css-media-queries');
const mediaQueries = [
'@media (min-width: 768px)',
'@media (max-width: 600px)',
'@media (min-width: 1024px)',
];
const sortedMediaQueries = mediaQueries.sort(sortCSSmq);
console.log(sortedMediaQueries);
css-mqpacker is a PostCSS plugin that packs same CSS media query rules into one media query rule. It helps in optimizing CSS by merging media queries, which can reduce the size of the CSS file. Unlike sort-css-media-queries, which focuses on sorting, css-mqpacker focuses on merging media queries.
postcss-sort-media-queries is a PostCSS plugin that sorts media queries in a specific order. It is similar to sort-css-media-queries in that it also focuses on sorting media queries, but it is designed to be used as a PostCSS plugin, making it more suitable for projects that already use PostCSS.
The custom
sort
method forcss-mqpacker
orpleeease
(which uses css-mqpacker) or, perhaps, something else ))
npm install --save sort-css-media-queries
# or using yarn cli
yarn add sort-css-media-queries
See the original docs at first https://www.npmjs.com/package/css-mqpacker#sort;
const sortCSSmq = require('sort-css-media-queries');
// your cool code
// ...
postcss([
mqpacker({
sort: sortCSSmq
})
]).process(css);
it's use es6 syntax
npm test
for testing js code style and test sorting methodnpm run fix
for automatically fix most of problems with js code stylePlease read CHANGELOG.md
FAQs
The custom `sort` method (mobile-first / desktop-first) of CSS media queries for `postcss-sort-media-queries`, `css-mqpacker` or `pleeease` (which uses css-mqpacker) or, perhaps, something else ))
The npm package sort-css-media-queries receives a total of 475,715 weekly downloads. As such, sort-css-media-queries popularity was classified as popular.
We found that sort-css-media-queries demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.