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

Update PostCSS dependencies #618

Merged
merged 3 commits into from
Jan 14, 2019
Merged

Update PostCSS dependencies #618

merged 3 commits into from
Jan 14, 2019

Conversation

adamwathan
Copy link
Member

This PR updates all of our PostCSS-related dependencies to the latest version, since I guess that's something we should occasionally do :)

Although most dependencies have been updated to a new major version, none of the breaking changes there really impact Tailwind except for one, which is postcss-selector-parser.

Prior to using the latest version of postcss-selector-parser, Tailwind has taken ownership of and responsibility for all escaping that needs to happen when using non-standard characters in class names, like we do with sm:text-blue (.sm\:text-blue) or w-1/4 (.w-1\/4).

Now, postcss-selector-parser tries to intelligently handle all escaping on our behalf (which is awesome!). However, in trying to push that work out to postcss-selector-parser, I discovered that it escapes : differently than we do (it uses the unicode codepoint \3A ), which when combined with this bug in css-loader causes all of Tailwind's classes that use colons to break when using webpack.

The underlying library causing the escaping to be handled differently is cssesc, which escapes colons that way to preserve compatibility with very old versions of IE.

Although this isn't really their problem (the bug is in css-loader), I've opened an issue on cssesc asking if they would consider dropping support for IE < 8, as that would fix this problem for our use case:

mathiasbynens/cssesc#18

For now, I am using a special API available in postcss-selector-parser that lets us bypass their escaping so we can still do it by hand. This is a big disappointment as I'm sure my implementation is incredibly naive and not remotely as robust, but it keeps things working at least as well as they worked before.

Updating and accommodating these dependencies fixes #613 as well, which I will add a failing test for shortly.

I am going to have to think very hard to figure out if there are other consequences to this update (likely in the plugin system if anywhere, and probably with the modifySelectors helper), so will work that out before including this in a release.

Latest postcss-selector-parser tries to be more intelligent about handling escape sequences for you. This is awesome! But our original code was handling escaping ourselves, so this change gets the tests passing for now, with the intent to stop doing escaping ourselves in the near future and instead rely on postcss-selector-parser to handle it for us, since I'm positive their implementation is significantly more robust.
@adamwathan adamwathan merged commit 50aaa86 into master Jan 14, 2019
@adamwathan adamwathan deleted the update-postcss-dependencies branch January 21, 2019 19:22
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.

Responsive border widths create wrong classes when size includes a dot
1 participant