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

How to use with NextJS and CSS modules? #7

Open
argyleink opened this issue Dec 15, 2021 · 7 comments
Open

How to use with NextJS and CSS modules? #7

argyleink opened this issue Dec 15, 2021 · 7 comments

Comments

@argyleink
Copy link
Member

the :root scope is "not pure" so the output doesn't work. could be solved if #1 was completed and :global could be specified.

@argyleink
Copy link
Member Author

now that :global can be specified, it's still not good enough to work with NextJS CSS Modules. might need to devise a strategy that builds to a separate file that's imported globally. then the jit-props plugin can see the usages and populate a file and fill :root with definitions, allowing a nextjs site to load those props as a file and avoid creating impure selectors.

@olafurns7
Copy link

@argyleink did give up on this adventure or is there a solution?

@argyleink
Copy link
Member Author

i've given up jit-props integration with next yeah, it's a micro-optimization that can easily be ignored for larger fish to fry.

@SalahAdDin
Copy link

SalahAdDin commented Jan 28, 2024

i've given up jit-props integration with next yeah, it's a micro-optimization that can easily be ignored for larger fish to fry.

If you are not using jit, what are you using then?

@argyleink
Copy link
Member Author

loading the props into :global and not worrying about shaking or pruning unused props.

if you are worried, you can do individual imports to reduce filesize, aka pick each prop set you need. not loading all the colors is a great place to start, just import the palettes you intend to use.

@SalahAdDin
Copy link

loading the props into :global and not worrying about shaking or pruning unused props.

if you are worried, you can do individual imports to reduce filesize, aka pick each prop set you need. not loading all the colors is a great place to start, just import the palettes you intend to use.

I wonder, how is your setup?

@argyleink
Copy link
Member Author

https://stackblitz.com/edit/nextjs-openprops?file=styles%2Fglobals.css

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

No branches or pull requests

3 participants