postcss-custom-properties icon indicating copy to clipboard operation
postcss-custom-properties copied to clipboard

[Feature request] Option for adding prefix/suffix to custom property names

Open SevenOutman opened this issue 5 years ago • 0 comments

I'm writing styles for a react component library and we're going to adopt custom properties. One thing I'm worrying is that global custom properties defined in my library may pollute those in the user application. One possible solution is adding a unique prefix for every custom properties in my library, e.g. --btn-bg -> --rs-btn-bg. So I wonder if I can have this option that allow adding prefixes/suffixes.

API Proposal

renameProperties: { test: RegExp, handler(originalName: string) => string }

Allows user to rename properties that matches the pattern they want.

prefix: string/suffix: string

Short for predefined renaming rules with '*' test pattern.

SevenOutman avatar Apr 17 '20 02:04 SevenOutman