castastrophe / postcss-dropunusedvars

A postcss plugin to drop unused custom properties
Apache License 2.0
2 stars 0 forks source link

Allow exclusion of certain properties #20

Open shoogstoel opened 1 year ago

shoogstoel commented 1 year ago

Thanks for the plugin, great job.

I ran into an issue where I was using certain custom properties during runtime. As they are technically unused during build time, the plugin went ahead and removed them (correctly so, given the current capabilities).

I'd love to have the option to exclude certain files and/or properties.

castastrophe commented 12 months ago

Great suggestion. I was just thinking I know I had written something just like this and where was it so I was poking around and I put it instead in a set of stylelint plugins that we'll be releasing soon from the @spectrum-tools namespace: stylelint-no-unused-custom-properties and stylelint-no-unknown-custom-properties. Both plugins will support ignoreList and allowList properties. Shouldn't be too bad to work those into this plugin but if you wanted to tackle that, PRs are appreciated.

I'd love to approach it like:

What do you think? Do those properties and definitions make sense?