soranoo / next-css-obfuscator

A package deeply inspired by PostCSS-Obfuscator but for Next.js.
https://next-css-obfuscator.vercel.app
MIT License
71 stars 3 forks source link

[Feature Request] Add the `regex` used to identify classes as one `config option` #28

Closed hoangnhan2ka3 closed 6 months ago

hoangnhan2ka3 commented 6 months ago

Checklist

  1. [x] Read all documentation
  2. [x] No related request
  3. [x] Meaningful issue title

Is your feature request related to a problem? Please describe. With Tailwind, sometimes we can add some complex class names as we like, or add custom variants (ref) with "special" characters. So perhaps having an option for users to edit the regex of the class identification logic would be a good idea.

The truth is that sometimes I want to tweak something to see if it works or not, but I don't really know which one to touch 🥲.

image

Describe the solution you'd like

It seems like this plugin wants to target many different UI libraries and frameworks, not just NextJs w/ Tailwind. So you can refer to the implementation of this VSCode extension:

image

And here is settings.json with its basic settings:

image

Additional context If you have time then do it, I think it would be a good idea!

hoangnhan2ka3 commented 6 months ago

Hey @soranoo, did you notice that 🤣

image

soranoo commented 6 months ago

Just noticed. If version 2 is out and it covers most of the features this package has. I will consider archiving this repo. Looking forward to your work! @n4j1Br4ch1D

soranoo commented 6 months ago

But before it is out I will continue to maintain this pkg.

soranoo commented 6 months ago

Checklist

  1. [x] Read all documentation
  2. [x] No related request
  3. [x] Meaningful issue title

Is your feature request related to a problem? Please describe. With Tailwind, sometimes we can add some complex class names as we like, or add custom variants (ref) with "special" characters. So perhaps having an option for users to edit the regex of the class identification logic would be a good idea.

The truth is that sometimes I want to tweak something to see if it works or not, but I don't really know which one to touch 🥲.

image

Describe the solution you'd like

It seems like this plugin wants to target many different UI libraries and frameworks, not just NextJs w/ Tailwind. So you can refer to the implementation of this VSCode extension:

image

And here is settings.json with its basic settings:

image

Additional context If you have time then do it, I think it would be a good idea!

I'm not going to expose the regexes behind the scenes. Many regexes are involved in getting the whole system to work. Once the regexes become accessible, it will definitely make the project much more difficult to maintain.

If your special chara involves the class name extraction, you can check out the extractClassFromSelector function in src/handlers/css.ts.