assets:precompile not compiling CSS assets

Okay this was extremely unexpected.

After reading cssbundling-rails’ (which I don’t use in my project) documentation, I found this: GitHub - rails/cssbundling-rails: Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.

You must have app/assets/builds available. Add the directory with a .gitkeep file, and you’ll ensure it’s available in production.

And that was it – the assets were digested correctly.

This is a bit perplexing because in the Fly production VM, I could find the assets compiled by dartsass-rails in that same exact folder (app/assets/builds/*.css), so I knew the folder existed; but the digested application-7577900c40f86606a5c6acaa00076c57a63f48a6.css etc were not in public/assets, so I also knew propshaft was not finding anything in app/assets/builds. There must be a dir creation order issue somewhere between dartsass-rails and propshaft.

Anyway, someone ought to add that warning to propshaft’s documentation I guess.

1 Like