This plugin convert all px values to rem.
npm i -D postcss7-px-to-rem
Configure your bundler for use this plugin.
###Before:
/* Before */
.someClass {
top: 10px;
}
/* postcss-px-to-rem-disable */
.otherClass {
top: 10px;
}
/* postcss-px-to-rem-enable */
###After:
.someClass {
top: 0.625rem;
}
.otherClass {
top: 10px;
}
Base size value, all pixels values converting to rem by divide to this value
Variable: base
Default value: 16
Example: 10px ===> 10/16 ===> 0.625rem
Precission of dividing
Variable: precision
Default value: 3
Prevent converting less than that value
Variable: minPixelValue
Default value: 0
To prevent converting some values by this plugin use css comments:
- postcss-px-to-rem-disable
- postcss-px-to-rem-enable
Copyright (c) Igor Pylypenko