cuth / postcss-pxtorem

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

add option to set whether replace 1px to rem #18

Closed dreamjser closed 8 years ago

dreamjser commented 8 years ago

add option to set whether replace 1px to rem(in production 1px to rem can't show)

cuth commented 8 years ago

Thank you for your pull request. I am considering adding it but there is already a way to ignore values.

https://github.com/cuth/postcss-pxtorem#a-message-about-ignoring-properties

This allows you to ignore border: 1PX but not letter-spacing: 1px.

hzlzh commented 8 years ago

this 1px option is useful to those project which is already 1px inside not 1PX. At most situation when we write 1px we really mean that retina 1px and hope not to be replaced by REM, so I use this PR in my project.

sylvainbaronnet commented 8 years ago

+1 to merge it

sylvainbaronnet commented 8 years ago

@cuth I use stylus with postcss and "1PX" is changed by stylus to "1 PX" (not sure why) so I can't use this method

Thanks to @dreamjser for the PR

cuth commented 8 years ago

I think you've convinced me but I'd rather see this option as a minimum pixel value with the default being zero. Then you could set it to 2 if you wanted to avoid converting 1px.

// default
{
  minPixelValue: 0
}

// to avoid 1px
{
  minPixelValue: 2
}

Also, I would like to deprecate all the underscores and change the options to camelCase.

Would this option satisfy you?

sylvainbaronnet commented 8 years ago

Even better :+1:

hzlzh commented 8 years ago

Cheers, That is more graceful.