cuth / postcss-pxtorem

Convert pixel units to rem (root em) units using PostCSS
MIT License
2.08k stars 172 forks source link

Media queries #12

Open mars-abd opened 9 years ago

mars-abd commented 9 years ago

I develop version for smartphones for some project and use this plugin. All styles compiles from pixels to rems, only base css rules are left in px, like this:

html { // for desktop
    font-size: 14px;
}
@media (max-width: 500px) { // for phones
    html {
        font-size: 11px;
    }
}

Generally it is good, fast and simple solution to make mobile version. But for some ui blocks I use media queries overrides for small screen. And I want to keep this values in pixels. It will be good to have ability to ignore css rules in media queries (not there – @media (max-width: 500px) )

BARMPlus commented 5 years ago

This happened to me, too. .postcssrc.js下

module.exports = { "plugins": { 'postcss-pxtorem': { rootValue: 32, propList: ['*'], mediaQuery: false }, "postcss-import": {}, "postcss-url": {}, // to edit target browsers: use "browserslist" field in package.json "autoprefixer": {} } }