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

Add :global() to inline css classes automatically #68

Closed
wants to merge 4 commits into from

Conversation

rvetere
Copy link
Collaborator

@rvetere rvetere commented Feb 14, 2024

fixes #53
Screenshot 2024-02-14 at 10 06 34

Copy link

vercel bot commented Feb 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yacijs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 14, 2024 9:20am

Copy link

codspeed-hq bot commented Feb 14, 2024

CodSpeed Performance Report

Merging #68 will not alter performance

Comparing feature/add-global-automatically (15186b5) with main (3ec0e6d)

Summary

✅ 2 untouched benchmarks

Copy link
Collaborator

@Mad-Kat Mad-Kat left a comment

Choose a reason for hiding this comment

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

Thank you for the PR :)

Could you add some more tests for the following cases where it should replace it:

import { styled, keyframes } from "next-yak";

const Component = styled.a\`
  .any-class:hover {
    color: red;
  }
\`;
import { styled, keyframes } from "next-yak";

const Component = styled.a\`
  :where(.any-class) {
    color: red;
  }
\`;

And a case where it shouldn't replace it:

import { styled, keyframes } from "next-yak";

const Link = styled.a\`
  color: palevioletred;
\`

const Icon = styled.svg\`
  \${Link} & {
    color: red;
  }
\`

).toMatchInlineSnapshot(`
".headline_0 {
color: red;
:global(dark-mode) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be :global(.dark-mode)

Copy link
Collaborator

@Mad-Kat Mad-Kat left a comment

Choose a reason for hiding this comment

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

I think it doesn't handle all cases yet, but feel free to change and rerequest a review once my points are fixed

@jantimon
Copy link
Owner

I'll close this for now because of the conflicts - feel free to reopen :)

@jantimon jantimon closed this Jul 23, 2024
@jantimon jantimon deleted the feature/add-global-automatically branch July 23, 2024 05:55
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.

automatically inject :global
3 participants