Roots Discourse

CSS MQpacker and sort-css-media-queries



Hi all

I’m trying to include the css-mqpacker, and sort-css-media-queries postCSS plugins in my build config.

I’ve managed to get css mq-packer working by adding the below to my postcss.config.js inside the plugins {} part.

"css-mqpacker": true,

I’m not sure where to start with the sort css media queries plugin though, here are the docs:

I’d be very grateful for any help.



Just a guess without testing - maybe try this:

"css-mqpacker": { sort: sortCSSmq }

instead of:

"css-mqpacker": true

(Make sure you also have sort-css-media-queries imported as sortCSSmq, of course.)


Hey mmirus

Thanks - that worked!

I just added the below to the top of the file:

const sortCSSmq = require("sort-css-media-queries");

Thanks again