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

[WIP]: tailwind v4 #7507

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

bjohansebas
Copy link

Description

Updated to Tailwind 4 :), still a work in progress

Check List

  • [] I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • [] I have run npm run format to ensure the code follows the style guide.
  • [] I have run npm run test to check if all tests are passing.
  • [] I have run npx turbo build to check if the website builds without errors.
  • [] I've covered new added functionality with unit tests if necessary.

Copy link

vercel bot commented Feb 23, 2025

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

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Mar 8, 2025 0:38am

@AugustinMauroy
Copy link
Member

something that may help you:

npx @tailwindcss/upgrade

and for css module: https://tailwindcss.com/docs/compatibility#css-modules

@bjohansebas
Copy link
Author

Yep, with that I made the first commit, I thought it was going to do most of the work

Copy link
Contributor

Note

Your Pull Request seems to be updating Translations of the Node.js Website.

Whilst we appreciate your intent; Any Translation update should be done through our Crowdin Project.
We recommend giving a read on our Translation Guidelines.

Thank you!

@ovflowd
Copy link
Member

ovflowd commented Mar 1, 2025

Hey @bjohansebas I assume this is still a WIP?

Copy link
Contributor

github-actions bot commented Mar 1, 2025

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 90%
88.75% (742/836) 76.1% (242/318) 87.65% (142/162)

Unit Test Report

Tests Skipped Failures Errors Time
182 0 💤 0 ❌ 0 🔥 5.406s ⏱️

@bjohansebas
Copy link
Author

Yep, I'll continue with this later.

@ovflowd
Copy link
Member

ovflowd commented Mar 1, 2025

Yep, I'll continue with this later.

tysm for your contributions <3

@bjohansebas
Copy link
Author

I think I'll continue after you all have done the migration to the new version of Next.js.

@AugustinMauroy
Copy link
Member

@bjohansebas bump claudio had merge the pr. You can have fun with git conflict 😁

Comment on lines -11 to -13
announcement: tailwindConfig.theme.colors.green['700'],
release: tailwindConfig.theme.colors.info['600'],
vulnerability: tailwindConfig.theme.colors.warning['600'],
Copy link
Author

Choose a reason for hiding this comment

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

I think I know how to make this work, I'll do it another day.

@@ -1,3 +1,5 @@
@reference "../../../../styles/index.css";
Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary? Can you point to docs?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I mean, can you write the reference of these like // @see ....

@import './locals.css';
@import './locals.css' layer(utilities);

@theme {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe export all these colors to a theme.css fle

--animate-pulse: pulse 500ms infinite alternate-reverse;
--animate-pulse-dark: pulse-dark 500ms infinite alternate-reverse;

@keyframes surf {
Copy link
Member

Choose a reason for hiding this comment

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

Id move all of these animations to an animations.css

@import './base.css';
@import './markdown.css';
@import 'tailwindcss';
@import './base.css' layer(utilities);
Copy link
Member

Choose a reason for hiding this comment

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

Id be good to explain what these "layer" keywords mean

Copy link
Author

Choose a reason for hiding this comment

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

No idea, it was done by the Tailwind upgrade tool, which didn’t really help much either.

scrollbar-width: thin;
}

@utility max-w-8xl {
Copy link
Member

Choose a reason for hiding this comment

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

This was removed?

Copy link
Author

Choose a reason for hiding this comment

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

That class was not recognized by Tailwind, maybe it never existed, since it was set in the configuration file of version 3.

@ovflowd
Copy link
Member

ovflowd commented Mar 3, 2025

image

Yeah something weird is broken. The instructions seem super simple: https://tailwindcss.com/docs/installation/framework-guides/nextjs

Not sure if this has any effect, https://github.com/nodejs/nodejs.org/blob/main/apps/site/next.config.mjs#L96 or if it is due to something you're importing or not? Maybe it could be those @reference's?

Worth opening an issue on Tailwind repo tho.

@AugustinMauroy
Copy link
Member

Not sure if this has any effect, https://github.com/nodejs/nodejs.org/blob/main/apps/site/next.config.mjs#L96

Nope I already faced to this issue. Basically tailwind is broken with css-module and tailwind maintainer don't care and didn't recommend to use it.

First tings to check:

  • if there are any pure selector for example : p or &:hover
  • if ref is correctly done

if this check is done it's maybe a bug

@ovflowd
Copy link
Member

ovflowd commented Mar 3, 2025

I have the feeling maybe because we do the @reference on each CSS module file? 🤔 which provably tries to bundle the whole thing on every css module file?

Nope I already faced to this issue. Basically tailwind is broken with css-module and tailwind maintainer don't care and didn't recommend to use it.

A lot of people use CSS modules. Could tou reference where the maintainer said they did not care about it?

@AugustinMauroy
Copy link
Member

A lot of people use CSS modules. Could tou reference where the maintainer said they did not care about it?

About maintainer position it's personal feeling. but about css module https://tailwindcss.com/docs/compatibility#performance

@bjohansebas
Copy link
Author

The @references are correct, because if they were wrong, it wouldn't work in development mode, that's how I discovered that I had to include them.

@bjohansebas
Copy link
Author

Sorry, I had to squash all the commits. It was getting complicated to do a rebase without losing all the work.

@bjohansebas
Copy link
Author

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2025

tailwindlabs/tailwindcss#16725

So just update to Tailwind 4.0.12?

@ovflowd
Copy link
Member

ovflowd commented Mar 8, 2025

A lot of people use CSS modules. Could tou reference where the maintainer said they did not care about it?

About maintainer position it's personal feeling. but about css module https://tailwindcss.com/docs/compatibility#performance

Per the docs, we shouldn't import everything, just the theme tokens. Which seems to mean, only the tokens need to be imported.

@bjohansebas
Copy link
Author

Finally compiled, I'm really happy!

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Mar 8, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 8, 2025
Copy link
Contributor

github-actions bot commented Mar 8, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 96 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 100 🟢 96 🟢 100 🟢 92 🔗
/en/download 🟢 97 🟢 96 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

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.

3 participants