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 10 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 ❌ Failed (Inspect) Mar 3, 2025 2:44am

@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 😁

@@ -33,7 +33,7 @@
}

.title {
@apply rounded-sm
@apply rounded-xs
Copy link
Member

Choose a reason for hiding this comment

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

Did the values change between xs and sm?

Copy link
Author

Choose a reason for hiding this comment

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

@@ -19,8 +19,7 @@
@apply max-h-80
w-48
overflow-hidden
rounded
border
rounded-sm border
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rounded-sm border
rounded-sm
border

@@ -15,14 +15,14 @@
}

.trigger {
@apply inline-flex
@apply r
ounded-sm
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ounded-sm
rounded-sm

@bjohansebas
Copy link
Author

This is almost done, the only thing is that I still haven't managed to get Next.js to compile. It throws an error (not sure if it's still due to the Tailwind configuration or a bug in Tailwind). The development mode is already working for the most part.

h-11
w-full
min-w-[17rem]
items-center
justify-between
items-center justify-between
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
items-center justify-between
items-center
justify-between

@@ -43,5 +43,7 @@ export default {
'import-notation': 'string',
// Allow the `@apply` at rule as its part of Tailwind
'at-rule-no-deprecated': [true, { ignoreAtRules: ['apply'] }],
'at-rule-no-unknown': null,
Copy link
Member

Choose a reason for hiding this comment

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

We already have a rule with at-rule-unknown. Please remove this one.

@@ -43,5 +43,7 @@ export default {
'import-notation': 'string',
// Allow the `@apply` at rule as its part of Tailwind
'at-rule-no-deprecated': [true, { ignoreAtRules: ['apply'] }],
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'at-rule-no-deprecated': [true, { ignoreAtRules: ['apply'] }],
'at-rule-no-deprecated': [true, { ignoreAtRules: [CUSTOM_AT_RULES] }],

@@ -43,5 +43,7 @@ export default {
'import-notation': 'string',
// Allow the `@apply` at rule as its part of Tailwind
'at-rule-no-deprecated': [true, { ignoreAtRules: ['apply'] }],
'at-rule-no-unknown': null,
'function-no-unknown': null,
Copy link
Member

Choose a reason for hiding this comment

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

Instead of disabling the rule, please provide the correct functions that should be allowlisted.

w-full
items-center
justify-between;
@apply inline-flex w-full items-center justify-between;
Copy link
Member

Choose a reason for hiding this comment

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

Please do not inline the styles.

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, my auto formatter played a trick on me.

Copy link
Member

Choose a reason for hiding this comment

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

(For the whole file)

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?

@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

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