google / postcss-rename

Replace class names based on a customizable renaming scheme.
Apache License 2.0
125 stars 18 forks source link

Support for regexes in 'except' #40

Closed torshid closed 3 years ago

torshid commented 3 years ago

Closes #38

Regexes can now be present in except in addition to strings.

except: [/full-.*/, ...] would both skip full-height and full-width.

Instead of checking if a node value is present in the exceptSet, I moved the logic to a function named skip.

Allowing except to be a function would also be nice, what do you think?

rzhw commented 3 years ago

Allowing except to be a function would also be nice, what do you think?

I can definitely see this is a natural next step, happy to take a PR for this as well.

Given the current approach of checking exceptSet and then iterating to check for regexes every time I'm somewhat concerned whether long run this might cause performance issues (versus splitting exceptSet by type for example), but for the time being I think this will suffice.

Thanks again! Will merge and do a release