rails / cssbundling-rails

Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.
MIT License
583 stars 84 forks source link

broken with rails 7.2? #159

Open josh-m-sharpe opened 4 days ago

josh-m-sharpe commented 4 days ago

Context: I've had cssbundling-rails (1.4.1) working with a rails 7.0.x app for a while now. I got in the mood to upgrade things and it appears that things didn't play super nice with rails 7.2.1.1

My deployment has included a simple "bundle exec rake assets:precompile" but that stopped compiling my application.sass.scss file (to application.css) resulting in runtime errors post deployment.

Sprockets::Rails::Helper::AssetNotFound (The asset "application.css" is not present in the asset pipeline.

I had to modify my prod deployment to also include "yarn build:css" prior to assets:precompile.

Is this by design?

The README here says:

When you deploy your application to production, the css:build task attaches to the assets:precompile task to ensure that all your package dependencies from package.json have been installed via yarn, and then runs yarn build:css to process your stylesheet entrypoint, as it would in development

But this didn't appear quite so automatic after this 7.2 upgrade.

Let me know what other details I can provide. Thanks!

josh-m-sharpe commented 4 days ago

this readme note is inconsistent: https://github.com/rails/cssbundling-rails?tab=readme-ov-file#why-do-i-get-applicationcss-not-in-asset-pipeline-in-production

the install script adds a .keep file not a .gitkeep file.

but regardless of the name of the file, the install script doesn't git add -f app/assets/builds/.keep which it probably should?

anyways, doing that and committing fixed this thing. so maybe we just need the install script updated and readme made consistent?

fwiw it's worth my .gitignore has

/app/assets/builds/*
!/app/assets/builds/.keep

which was added when cssbundling was originally added to the project way back when