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

Move application.tailwind.css to a dir ignored by propshaft #474

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

flavorjones
Copy link
Member

@flavorjones flavorjones commented Jan 24, 2025

This file should not be included in the stylesheet link tags served to user agents. But by default, Rails 8 apps add a tag for all CSS files under app/assets (courtesy of a Propshaft feature handling a source named :all), and so this file is being included unintentionally.

Going forward, in version 4.x of this gem (which pins to Tailwind v4), the installer will place the file into app/assets/tailwind. The upgrader will move it from app/assets/stylesheets to app/assets/tailwind.

And the gem's railtie adds app/assets/tailwind to config.assets.excluded_paths to make sure it doesn't get served up by the stylesheet_link_tags :app call in the application layout.

This is being tested with both Rails 7.2 (without Propshaft) and Rails 8 (with Propshaft) and it looks good.

Fixes #470

This file should not be included in the stylesheet link tags served to
user agents.

Fixes #470
@flavorjones flavorjones force-pushed the flavorjones-move-application-tailwind-css branch from 169e7f0 to 31621ea Compare January 24, 2025 18:50
@flavorjones flavorjones requested a review from dhh January 24, 2025 18:56
@flavorjones
Copy link
Member Author

I'm not positive this is the best possible implementation of a fix, but I'm feeling a bit of time pressure and this is good enough to ship in a second release candidate.

@flavorjones flavorjones merged commit a0eaafa into main Jan 26, 2025
17 checks passed
@flavorjones flavorjones deleted the flavorjones-move-application-tailwind-css branch January 26, 2025 19:05
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.

v4.0.0-rc1 - Bundled application.tailwind.css gets 404 trying to load /assets/tailwindcss
1 participant