Skip to content

case insensitive processing and consistent cloning #502

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

Merged
merged 18 commits into from
Jul 2, 2022

Conversation

romainmenke
Copy link
Member

@romainmenke romainmenke commented Jun 25, 2022

  • ensure we handle everything case insensitive when specified as such
  • ensure we always clone so that the modified nodes are revisited by all plugins

@romainmenke
Copy link
Member Author

romainmenke commented Jun 28, 2022

Starting to wonder if I jinxed it when I decided that relaxing the PostCSS version constraint didn't warrant a re-release of all plugins. Probably not coincidental that I find a new error class that affects most plugins days later :D

@romainmenke romainmenke marked this pull request as ready for review July 1, 2022 17:36
@github-actions github-actions bot added plugins/postcss-stepped-value-functions PostCSS Stepped Value Functions plugins/postcss-trigonometric-functions PostCSS Trigonometric Functions labels Jul 1, 2022
"plugins/postcss-rebeccapurple":
- plugins/postcss-rebeccapurple/**
- experimental/postcss-rebeccapurple/**
"plugins/postcss-color-rebeccapurple":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

return;
}

// value of the :dir pseudo-class
const value = node.nodes.toString();
const value = node.nodes.toString().toLowerCase();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is later concatenated below which means this won't preserve developer casing. Is this something we should do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I was indeed trying to avoid changing things and only using lower cased values in conditionals.

I will update this 🎉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coincidentally this was actually more correct imo.

  • [dir="RTL"] or [dir="rtl"] is not the same.
  • we generate :not([dir="<inverse>"]).

I think it is best to allow upper case in :dir and keywords but only output lowercase.

@@ -11,16 +12,33 @@ function creator(opts) {
postcssPlugin: 'postcss-gap-properties',
// walk decl shorthand gap, column-gap, or row-gap declaration
Declaration(decl) {
if (gapPropertyRegExp.test(decl.prop) && decl.parent.some(isDisplayGrid)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Member

@Antonio-Laguna Antonio-Laguna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really impressive! Thanks for bringing up this so it's even closer to spec. I've left one minor comment but feel free to ignore it if it's fine.

The reasoning was that I'm OK with producing lowercase code but this seemed like transforming the user's code

@romainmenke romainmenke merged commit 483f85c into main Jul 2, 2022
@romainmenke romainmenke deleted the case-insensitive--sensible-wolverine-14524204cc branch July 2, 2022 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment