jantimon / next-yak

a streamlined CSS-in-JS solution tailor-made for Next.js, seamlessly combining the expressive power of styled-components syntax with efficient build-time extraction and minimal runtime footprint, ensuring optimal performance and easy integration with existing atomic CSS frameworks like Tailwind CSS
https://yak.js.org
118 stars 4 forks source link

add support for vitest / jest #56

Closed jantimon closed 3 months ago

jantimon commented 9 months ago

find a way how next-yak does not prevent users from writing ui components tests

jantimon commented 3 months ago

Possible solution

We could split the code so that all APIs which get transpiled by the Babel plugin (like styled, keyframes, css, etc.) to a new next-yak/internal module.
Here's how it would work:

  1. Our Babel plugin would automatically replace imports like import { styled } from "next-yak" with import { styled } from "next-yak/internal"
  2. We'd keep a test-friendly version of these APIs in the main next-yak export

Benefits

For our users:

For us maintainers:

Potential Downsides

Side Nodes