[Admin] Fix tailwindcss-rails Version to v3 for Solidus Admin Compatibility#6135
Merged
tvdeyen merged 1 commit intosolidusio:mainfrom Feb 19, 2025
Conversation
…bility ## Background Currently, running `bin/rails solidus_admin:tailwindcss:install` installs the latest v4 of `tailwindcss-rails`. This causes compatibility issues because Solidus Admin expects the Tailwind CSS v3 configuration. Tailwind CSS v4 introduces CSS First Configuration, which alters the structure and handling of the `tailwind.config.js` file. Using v4 results in a configuration where `tailwind.config.js` does not function properly. Reference: https://tailwindcss.com/blog/tailwindcss-v4#css-first-configuration While ideally, Solidus Admin should be updated to work with Tailwind CSS v4 and later, we have restricted it to v3 for now to ensure correct functionality. Additionally, the maintainers of `tailwindcss-rails` do not recommend upgrading to v4 at this time (see: https://github.com/rails/tailwindcss-rails?tab=readme-ov-file#you-dont-_have_-to-upgrade). ## Solution Modified the installation command in `install_tailwindcss.rb` to explicitly install v3: ```ruby unless bundle_command "show tailwindcss-rails" bundle_command "add tailwindcss-rails --version '~>3.0'" end ``` This change ensures that running bin/rails solidus_admin:tailwindcss:install installs Tailwind CSS v3, which is compatible with Solidus Admin's current configuration. If there is anything else that should be added or any improvements that can be made, please let me know.
tvdeyen
approved these changes
Feb 19, 2025
Member
tvdeyen
left a comment
There was a problem hiding this comment.
Thanks. 🙏
Note: We really need to think about compiling the stylesheets and js files into the gem and simply serve it from whatever tool the app uses (sprockets or propshaft)
For now this fixes installation issues.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6135 +/- ##
=======================================
Coverage 88.81% 88.81%
=======================================
Files 835 835
Lines 18146 18146
=======================================
Hits 16116 16116
Misses 2030 2030 ☔ View full report in Codecov by Sentry. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Currently, running
bin/rails solidus_admin:tailwindcss:installinstalls the latest v4 oftailwindcss-rails. This causes compatibility issues because Solidus Admin expects the Tailwind CSS v3 configuration.Tailwind CSS v4 introduces CSS First Configuration, which alters the structure and handling of the
tailwind.config.jsfile. Using v4 results in a configuration wheretailwind.config.jsdoes not function properly. Reference: https://tailwindcss.com/blog/tailwindcss-v4#css-first-configurationWhile ideally, Solidus Admin should be updated to work with Tailwind CSS v4 and later, we have restricted it to v3 for now to ensure correct functionality. Additionally, the maintainers of
tailwindcss-railsdo not recommend upgrading to v4 at this time (see: https://github.com/rails/tailwindcss-rails?tab=readme-ov-file#you-dont-_have_-to-upgrade).Solution
Modified the installation command in
install_tailwindcss.rbto explicitly install v3:This change ensures that running bin/rails solidus_admin:tailwindcss:install installs Tailwind CSS v3, which is compatible with Solidus Admin's current configuration.
If there is anything else that should be added or any improvements that can be made, please let me know.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: