cuth/postcss-pxtorem

Better solution to ignore properties

Opened this issue · 2 comments

jpt commented

I appreciate the mention of a workaround in the docs but I wonder if something like this would be a better pattern, similar to the behavior used by eslint (i.e. with a comment):

Input:

h1 {
  font-size: 48px;
}
h2 {
  /* pxtorem-disable-next-line */
  font-size: 24px;
}

Output:

h1 {
  font-size: 3rem;
}
h2 {
  font-size: 24px;
}

I haven't looked at the source yet to see what kind of lift this would be, but would you accept a PR with this kind of solution?

Cheers, and thanks for the great library
Jeremy

cuth commented

Yeah. Love the solution!

A similar solution could also be used for forcing the transformation of custom properties:

:root {
  /* pxtorem-transform */
  --font-size-h1: 24px;
}