postcss-pxtorem
postcss-pxtorem copied to clipboard
Media queries
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) )
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": {} } }