Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional safelist regex variations #7674

Closed
wants to merge 2 commits into from

Conversation

mrinx
Copy link
Contributor

@mrinx mrinx commented Feb 26, 2022

This pull request is trying to bring a new way of doing regex safelisting, and to allow for color opacities in a safelist with regex (#6770).

The current format:

safelist: [
  {
    pattern: /bg-(red)-(100|200)/,
    variants: ['hover'],
  },
],

The new formats:

safelist: [
  {
    pattern: [['hover'], /bg-(red)-(100|200)/, ['50']],
    pattern: [['hover'], /bg-(green)-(100|200)/],
    pattern: [/bg-(blue)-(100|200)/, ['50']],
    pattern: [/bg-(yellow)-(100|200)/],
  },
],
safelist: [
  /bg-(red)-(100|200)/,
],
safelist: [
  [['hover'], /bg-(red)-(100|200)/, ['50']],
  [['hover'], /bg-(green)-(100|200)/],
  [/bg-(blue)-(100|200)/, ['50']],
  [/bg-(yellow)-(100|200)/],
],

@adamwathan, is this something you had in mind (#7582)?

@adamwathan
Copy link
Member

Awesome thank you! I made a couple small tweaks to remove support for this option:

safelist: [
  {
    pattern: [['hover'], /bg-(red)-(100|200)/, ['50']],
    pattern: [['hover'], /bg-(green)-(100|200)/],
    pattern: [/bg-(blue)-(100|200)/, ['50']],
    pattern: [/bg-(yellow)-(100|200)/],
  },
],

...just because thinking about it again I just don't see a reason to support it, better to just use the top-level tuple format.

Going to review this idea with the team this week before merging but I think this is going to be an improvement, thanks again.

@adamwathan
Copy link
Member

Hey thanks again for this! Decided on a slightly different approach which we've opened a PR for here:

#8774

So going to close this, but included you as a co-author on that one for your efforts here ❤️

@adamwathan adamwathan closed this Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants