Skip to content

Pin the npm upgrade task to @tailwindcss/[email protected] #544

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

Merged
merged 1 commit into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Then, run `bin/rails tailwindcss:upgrade`. Among other things, this will try to
- If present, moves `app/assets/stylesheets/application.tailwind.css` to `app/assets/tailwind/application.css`.
- Removes unnecessary `stylesheet_link_tag "tailwindcss"` tags from the application layout.
- Removes references to the Inter font from the application layout.
- Runs the upstream upgrader (note: requires `npx` to run the one-time upgrade, but highly recommended).
- Runs v4.1.4 of the upstream upgrader (note: requires `npx` to run the one-time upgrade, but highly recommended).

</details>

Expand All @@ -145,7 +145,7 @@ $ bin/rails tailwindcss:upgrade
remove app/assets/stylesheets/application.tailwind.css
10.9.0
Running the upstream Tailwind CSS upgrader
run npx @tailwindcss/upgrade --force --config /home/user/myapp/config/tailwind.config.js from "."
run npx @tailwindcss/upgrade@4.1.4 --force --config /home/user/myapp/config/tailwind.config.js from "."
≈ tailwindcss v4.0.0
│ Searching for CSS files in the current directory and its subdirectories…
│ ↳ Linked `./config/tailwind.config.js` to `./app/assets/tailwind/application.css`
Expand Down
8 changes: 7 additions & 1 deletion lib/install/upgrade_tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@
end

if system("npx --version")
# We're pinning to v4.1.4 because v4.1.5 of the upgrade tool introduces a dependency version check
# on tailwind and I haven't been able to figure out how to get that to work reliably and I am
# extremely frustrated with the whole thing. See #544
#
# At some point we will probably need to unpin this at which point I am sincerely hoping that
# someone else will do it.
say "Running the upstream Tailwind CSS upgrader"
command = Shellwords.join(["npx", "@tailwindcss/upgrade", "--force", "--config", TAILWIND_CONFIG_PATH.to_s])
command = Shellwords.join(["npx", "@tailwindcss/upgrade@4.1.4", "--force", "--config", TAILWIND_CONFIG_PATH.to_s])
success = run(command, abort_on_failure: false)
unless success
say "The upgrade tool failed!", :red
Expand Down