This repository was archived by the owner on Oct 21, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork2
A postcss plugin that will optimize your media queries.
License
NotificationsYou must be signed in to change notification settings
filamentgroup/postcss-media-query-optimizer
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A postcss plugin that will optimize your media queries.
- Removes
@media (max-width: 0) {}blocks - Removes max < min:
@media (min-width: 400px) and (max-width: 320px) {} - Simplifies
@media (min-width: 400px) and (min-width: 320px) {}to@media (min-width: 400px) {}(You probably don’t write this kind of code but for us it came from Mixin usage in SASS. Also, this solves an IE11 issue that uses the last*-widthif multiple*-width’s exist). - Simplifies
@media (min-width: 0) {}to@media all {} - Simplifies
@media (min-width: 0) and (max-width: 400px) {}to@media (max-width: 400px) {}
- Only supports
emandpxunits in media queries (for now). - Future TODO: Does not yet optimize across comma separated (OR) expressions. Would be better if
(min-width: 20em), (min-width: 30em)would simplify to(min-width: 20em).
Install from npm:postcss-media-query-optimizer
npm install postcss-media-query-optimizer --save-devTODO
module.exports = function(grunt) {grunt.loadNpmTasks("grunt-postcss");grunt.initConfig({postcss: {options: {processors: [require("../../Code/postcss-media-query-optimizer")()]},dist: {src: "**/*.css"}}// …});};npx ava- This plugin borrows heavily from
postcss-media-minmax. - Uhh, a thing I found after I made this that performs a similar task:
postcss-mq-optimize
About
A postcss plugin that will optimize your media queries.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.