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

Conversation

Projects
None yet
1 participant
@adamwathan
Copy link
Member

adamwathan commented Jan 14, 2019

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.

@adamwathan adamwathan force-pushed the update-postcss-dependencies branch from 63c8793 to 6c86a38 Jan 14, 2019

adamwathan added some commits Jan 14, 2019

Get tests passing with updated dependencies
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 force-pushed the update-postcss-dependencies branch from 6c86a38 to 2b5358d Jan 14, 2019

@adamwathan adamwathan merged commit 50aaa86 into master Jan 14, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@adamwathan adamwathan deleted the update-postcss-dependencies branch Jan 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment