SassNinja / media-query-plugin

Webpack plugin for media query extraction.
MIT License
205 stars 27 forks source link

media-query-plugin vs. postcss-combine-media-query #24

Closed rpb138 closed 4 years ago

rpb138 commented 4 years ago

Hi,

Could you explain the difference between media-query-plugin and postcss-combine-media-query, please?

Thanks so much.

SassNinja commented 4 years ago

Hi @rpb138

media-query-plugin is a webpack plugin which extracts media query rules from your CSS file(s) and places them in other files so you're able to load them on demand (e.g. only on desktop)

postcss-combine-media-query is a PostCSS plugin meaning you can use with any build tool (it's not limited to webpack) to combine equal media query rules.

So the former is about extraction (multiple files) whereas the latter is about minimization (same file). In case of webpack you can use both at the same time.

I hope has made the differences clear.