Replies: 11 comments 17 replies
-
@excid3 Thanks so much for the experience report. I definitely want to update the documentation with an "upgrade" section so it's very helpful to have access to someone's experience other than my own. If other folks want to add their notes there, I would be very thankful! 🙏 |
Beta Was this translation helpful? Give feedback.
-
Tailwind CSS v4 is out, as is v4.0.0 of the tailwindcss-ruby gem. The upstream upgrade guide is at https://tailwindcss.com/docs/upgrade-guide. If you're not ready to upgrade, then pin your project to the 3.x releases: # If you're not ready to upgrade yet!
gem "tailwindcss-ruby", "~> 3.4" |
Beta Was this translation helpful? Give feedback.
-
For context, my environment does not use any JavaScript tooling—I am only using this gem and nothing else. The Tailwind upgrade tool fails if the packages required in PS: After running the upgrade tool in another stack project that uses React, I noticed it also migrates the class names in the markup. However, this migration is not being applied to ERB files when run in a Rails project. I'm trying to figure out how to make it work (If there's a way). |
Beta Was this translation helpful? Give feedback.
-
Nice! I was about to install |
Beta Was this translation helpful? Give feedback.
-
I've released a v4.0.0.rc1 release candidate. I would appreciate feedback if anyone has time to try it out, both upgrading existing apps and installing tailwind into apps. https://github.com/rails/tailwindcss-rails/releases/tag/v4.0.0.rc1 Just drop a note here to let me know if it works, or if it doesn't. Unless something unexpected comes up, I plan to cut a final release tomorrow, 2025-01-24. |
Beta Was this translation helpful? Give feedback.
-
I just gave it a try but running into issue trying to run the upgrade command. I am not using any JS bundling. Just this gem. Same setup as @EricGusmao above
It seems to be expecting tailwind being installed using npm, having a node_modules folder present? Is there an upgrade path without that? |
Beta Was this translation helpful? Give feedback.
-
New install seems to work fine. |
Beta Was this translation helpful? Give feedback.
-
Using an existing Rails 8.1.0.alpha app, Propshaft, and devcontainer without Node I didn't run into any issues manually upgrading following: https://tailwindcss.com/docs/upgrade-guide as indicated. When starting
Thinking I was missing a dependency but turns out it's just a notice and changes are picked up automatically as expected. |
Beta Was this translation helpful? Give feedback.
-
Also note that some errors may be caused by plugins in your |
Beta Was this translation helpful? Give feedback.
-
After being able to have the upgrade script run successfully, the watcher using In both cases the server stops with the following log output when running
When trying to run it standalone in console, it just returns without any error:
|
Beta Was this translation helpful? Give feedback.
-
@drale2k @mwala-zm @flavorjones I think I've found a better way to handle plugin migrations without relying on the npm Warning In order to update class names in the views, PostCSS must be added. If you’re not using any JS tooling, do the following: After updating /node_modules (So the Tailwind update tool won’t dig through your node_modules files and infer incorrect migrations, because it complies with Then create a package.json in the root of the project: {
"name": "app_name",
"version": "1.0.0",
"dependencies": {
"tailwindcss": "^3.4.17", // Mandatory!!
// Install all plugins and modules that are referenced in tailwind.config.js
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/container-queries": "^0.1.1",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16"
// And so on...
}
} Now the upgrade task should run fine, and you can remove the Important You must keep the plugins as dependencies because Tailwind’s If there’s something I’m missing, anyone can feel free to point it out. Improvements on this procedure or better solutions—please share. Thanks! |
Beta Was this translation helpful? Give feedback.
-
First off, everything works great with Tailwind v4 beta. 🎉
One of the changes is that it uses CSS-first configuration now. This is helpful and makes the
tailwind.config.js
optional. In fact, the config can be specified inside the CSS now, for backwards compatibility.v4 Also uses LightningCSS, so autoprefixer, postcss-present-env, etc are also no longer required.
The recommended way for configuring now is using CSS variables for everything and since the config is optional now, I would consider removing it from the installer.
Also probably need to re-evaluate how this is handled in compile_command. It seems like the config option is ignored if the file doesn't exist, so that didn't cause any issues with the upgrade for me.
One other thing that I would mention is their upgrade tool. A few of the class names have changed and TailwindCSS v4 now includes it's own built-in import support. The upgrade tool can take care of a good 90% or more of updating from v3.
I'm not sure if it makes sense to do anything other than drop this into the README or an UPGRADE.md doc, but it is very helpful.
Beta Was this translation helpful? Give feedback.
All reactions