-
Notifications
You must be signed in to change notification settings - Fork 68
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
Next.js integration example #603
Comments
Heya! Thanks for the issue Can you add bespoke webpack plugins to next? You could try using the webpack loader |
Yes, it is possible to add webpack plugins in Next.js. However, I feel that there's more to that, regarding:
Setting all these up requires a bit of understanding of how the library works under the hood. Other CSS-in-JS libraries either provide:
|
That's fair! Currently without the CSS extraction story (spike here: #561) you can actually just add the webpack plugin and all your points will work.
So you should just be able to add the plugin and you're good to go! When the CSS extraction comes into play, as well as extracting from NPM packages - then it'll be slightly more complex (but it isn't shipped yet). |
Hey @Madou thanks for the info, I'll give it a try then. As a side note: what is the plan regarding CSS extraction? do you plan to ship it sometimes this year? |
Good luck! We are hoping to ship this year yes |
@Madou one more thing: When you say CSS extraction, do you mean:
|
The latter
…On Thu, 4 Mar 2021, 6:44 pm Andrei Pfeiffer, ***@***.***> wrote:
@Madou <https://github.com/madou> one more thing:
When you say CSS extraction, do you mean:
1. Critical CSS extraction for SSR?
2. Static CSS files extraction, without runtime?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#603 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABT4PHJZXEFMQ4NGAO7CBKTTB426LANCNFSM4YPYXUFQ>
.
|
As I said, theoretically it's simple, but the devil is in the details :)
Apparently, there are a lot of such errors reported on the web, and it seems to be due to a breaking change in webpack versions: https://webpack.js.org/migrate/5/#getoptions-method-for-loaders What version of webpack does your plugin supports? |
It supports v5, we should put a peer dependency if it's not in there - sorry! |
I'll spend some time setting up an example, i'll put up a PR against next. |
I've updated compiled to work with v4 and also added a next example here vercel/next.js#22786 👍 let me know how you go |
Hey @Madou thanks a lot, man, I really appreciate the effort.
|
@Madou there's only 1 thing I cannot figure out: Is there any specific API or approach for defining global styles? |
@Madou apart from the global styles question mentioned above, I have some more questions:
|
Hello
not at this time #62
react only for now.
not at this time #18
yes |
Hi @Madou don't know where is best to post this, but here's the review on the library: Thank you again for helping out with this. |
Thanks! Re:
What do you mean by this? Also totally agree with the ClassNames component. I wrote up a thought here #618 |
Regarding unused bundle styles, it's something that each library does one way or another (see the This is more prevalent in libraries that support any arbitrary nested selector, as it doesn't enforce good practices for scalable CSS, so anybody could add any nested rules, that the library doesn't check against the template to see if they really are used (I understand that it could be way too involved to do this, and in some case like dynamic selectors or certain pseudos it's practically impossible). The only libraries that I haven't seen to bundle nested styles are:
I think I should probably move that bullet into the Overall observations section, as all libs have this behaviour. |
Sure! There is a strict mode we'd like to investigate later, see: #182 Realistically though it would be an opt in thing. If we do it. |
Oohhh, very nice. For backwards compatibility, you would probably have it opt-in, yes. However, if you implement such a feature, then:
Considering the above 2 statements, you could flip the logic:
... just a thought. |
Is your feature request related to a problem? Please describe.
I would like to include Compiled in my CSS-in-TS analysis.
Describe the solution you'd like
A working example with Next.js will greatly help.
Describe alternatives you've considered
I've searched for articles or any example, but couldn't find any.
I've also searched the Next.js examples folder.
The text was updated successfully, but these errors were encountered: