cuth / postcss-pxtorem

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

Add ability to use font size from root element #11

Closed niksy closed 6 years ago

niksy commented 9 years ago

Right now, you have to explicitly declare root font size value as argument for plugin. It would be good if plugin could read input CSS and read html/root element font size value and use that as starting point. If there is no value, use current (and browser) default, 16px.

cuth commented 9 years ago

Thanks for the suggestion. Can this be done cleanly? Seems like you would rather just tell PostCSS explicitly what base font size you're using then have it search the whole document for html selectors and use the last font-size declaration with the greatest specificity. Also, if you split up your CSS files, this could cause unwanted inconsistencies among the base font size.