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

At rule fixes #326

Merged
merged 2 commits into from
Sep 23, 2017
Merged

At rule fixes #326

merged 2 commits into from
Sep 23, 2017

Conversation

emmatown
Copy link
Member

What:
Change the way at rules are joined

Why:
We had two plugins for insertion and it fixes bugs with non-nested at rules

How:
https://github.com/thysultan/stylis.js/blob/master/stylis.js#L339-L356

Checklist:

  • Documentation N/A
  • Tests
  • Code complete

cc @giuseppeg

@codecov
Copy link

codecov bot commented Sep 22, 2017

Codecov Report

Merging #326 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
+ Coverage   96.49%   96.53%   +0.03%     
==========================================
  Files          16       16              
  Lines         571      577       +6     
  Branches      138      138              
==========================================
+ Hits          551      557       +6     
  Misses         15       15              
  Partials        5        5
Impacted Files Coverage Δ
packages/emotion/src/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 272f5b2...a96963f. Read the comment docs.

@emmatown emmatown merged commit baf9b95 into master Sep 23, 2017
@emmatown emmatown deleted the at-rule-fixes branch September 23, 2017 04:58
@giuseppeg
Copy link

giuseppeg commented Sep 24, 2017

@mitchellhamilton cool, I had to fix a few more bugs.. eg @import @charset are ignored in your patch. https://github.com/zeit/styled-jsx/blob/d4e21c38797da2cd5529953a617190abbcc0447b/src/lib/style-transform.js#L92

There are still a few edge cases where it fails but I might ignore them for now.

@emmatown
Copy link
Member Author

@giuseppeg Just had a quick look at your fixes, I'm pretty sure they would break if there was more than just the @import or @charset in the css because the -2 context is when the css is done processing and the content has all of the css. I think it would work if it was like this

if (context === 1) {
  if (content.charAt(0) === '@') {
    splitRulesQueue.push(content)
    return ''
  }
}

@giuseppeg
Copy link

oh right silly me, thanks for the heads up

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.

3 participants