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

Proper handling of selectors containing escaped characters #35

Closed
ghost opened this issue Dec 14, 2018 · 12 comments
Closed

Proper handling of selectors containing escaped characters #35

ghost opened this issue Dec 14, 2018 · 12 comments
Labels

Comments

@ghost
Copy link

ghost commented Dec 14, 2018

Thanks for your work on this. I noticed it currently does not handle selectors that contain escaped characters such as : used by TailwindCSS, e.g. .focus\:bg-white.

@JPeer264
Copy link
Owner

Hey @mfarhadpur, I never saw this style of CSS. You think it is ok if .focus\:bg-white gets renamed to e.g. .a? Or must it be .a\:bg-white?

@ghost
Copy link
Author

ghost commented Dec 14, 2018

Thanks for the reply. Yes, that should be fine. Just the backslash is only used in the CSS, e.g. the above class is used as focus:bg-white in HTML and JS.

@JPeer264
Copy link
Owner

Alright. I'll implement it the next days.

@ghost
Copy link
Author

ghost commented Dec 14, 2018

Thanks!

@JPeer264
Copy link
Owner

@mfarhadpur please checkout rename-css-selectors@3.1.2. If your issue is not yet resolved, feel free to reopen this issue.

@ghost
Copy link
Author

ghost commented Dec 17, 2018

@JPeer264 Thanks for working on this. I think you should re-open the issue, as there are still bugs.

So, basically such a selector is defined as:

.focus\:bg-white:focus {
  background-color: #fff;
}

And used as:

<a href="#" class="focus:bg-white">Link<a>

Note that unescaped : denotes a pseudo-class in CSS and should not be removed. Right now, the class remains untouched in HTML/JS .i.e. focus:bg-white instead of being renamed to say b, and in CSS it is changed to:

.b {
  background-color: #fff;
}

While it should be:

.b:focus {
  background-color: #fff;
}

@JPeer264
Copy link
Owner

Uff. Sorry I totally missed that. I hope I can fix this soon.

@ghost
Copy link
Author

ghost commented Dec 18, 2018

No worries, whenever you find the time. Just to reiterate, there's also the issue of renames not being applied in HTML/JS.

@JPeer264
Copy link
Owner

Seems like I did not write enough tests for it ;) Gonna be fixed the next iteration.

@JPeer264
Copy link
Owner

@mfarhadpur I hope I finally got all the bugs fixed with version 3.1.3 🎉. So again. Feel free to reopen if I missed something, and thanks for your patience ;)

@ghost
Copy link
Author

ghost commented Dec 23, 2018

@JPeer264 Thanks! Everything seems to be working fine. Would you mind also updating the PostCSS plugin to use the latest core, whenever you have the time?

@JPeer264
Copy link
Owner

Done. postcss-rcs@2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant