postcss-pxtorem icon indicating copy to clipboard operation
postcss-pxtorem copied to clipboard

Better solution to ignore properties

Open jpt opened this issue 5 years ago • 2 comments

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

jpt avatar Jun 13 '20 01:06 jpt

Yeah. Love the solution!

cuth avatar Jun 13 '20 02:06 cuth

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

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

freesh avatar Sep 27 '21 09:09 freesh