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 layer example #179

Closed jantimon closed 5 days ago

jantimon commented 5 days ago

This PR adds examples demonstrating CSS @layer support in next-yak, showcasing how layers can be used to manage style precedence and cascade in a more structured way

CSS @layer is a powerful addition to CSS that allows developers to explicitly manage the cascade and control specificity. When combined with next-yak, it offers several key benefits:

Example:

@layer global, components, theme;

const Button = styled.button`
  @layer components {
    /* Base styles */
    background: white;
  }
  @layer theme {
    /* Theme-specific overrides */
    ${({ theme }) => theme.dark && css`
      background: black;
    `}
  }
`;