-
Notifications
You must be signed in to change notification settings - Fork 106
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
When running assets:precompile, Propshaft includes individual digested files for all CSS / JS instead of only bundles #227
Comments
I spotted three question marks, I could only help with some. The digest is intended to be used with Cache-Control: immutable. I hope you already know this, I just provided the answer as feedback to your question. Assuming that the inverse of this statement is what you want:
Have you read bypassing the digest step yet? |
The reason your
|
Thanks, I missed that but I set that and it's still digesting everything in stylesheets and javascript dependencies. For example it still produced this output: The project I'm using doesn't even use Trix so I don't know where that's coming from, but that's a separate issue. That output was with The result I'm looking to get is:
You can reproduce this in my Rails starter app project at: https://github.com/nickjj/docker-rails-example To run it in production mode you'd modify the export COMPOSE_PROFILES=postgres,redis,web,worker,cable
export RAILS_ENV=production
export NODE_ENV=production
export DOCKER_WEB_VOLUME=./public:/app/public Then You can run |
Most likely happening because you're loading
The rationale for including all assets when precompiling is to support modern nobuild techniques that don't require you to use CSS and JS bundlers. This is one of the biggest changes from sprockets and I doubt it will change in the short term. You can run
This most likely happens because If you don't exclude Your main concern in this issue (that all files are included) is the expected behaviour at the moment, and there's an existing issue in #89. |
Yep that is the case here.
It's a little surprising Propshaft doesn't act on the If Propshaft's goal is to analyze CSS / JS files to do replacements and then digest the files, if it operated on |
The |
Thanks, in that case there might be a bug around exclusions. If the expected order of operations is:
Then if I ignore the app's css and js directories then the expectation is I would only have processed and digested bundled files in the My previous comment has an example project with repeatable steps to verify that. |
Libraries that integrate with Rails (through railties) or Rails engines will add more paths to the load path if necessary. You'll need to pick the libraries you want to use (in |
The files being picked up by Propshaft are independent of that. These are CSS and JS files in my project that it's digesting, which were excluded.
This also seems like a bug? If the builds directory is capable of being digested by Propshaft, then it doing a find and replace on those files to do the in-file CSS and JS digests should be included too?
That could work but adding a custom post-deploy step in all projects that use esbuild seems like it goes against the grain of convention over configuration? |
Sorry for not being precise. You won't be able to use |
Hello,
I'm using Rails 8 with Propshaft v1.1.0 along with jsbundling and cssbundling where esbuild is doing the bundling.
After running
assets:precompile
in production mode the following files are created inpublic/
:The concern here is all of the JS and CSS files. When I was using Sprockets, only the
application-xxx.js
andapplication-xxx.css
files were created but with Propshaft it's generating digested files for everything.Based on the Propshaft documentation I thought maybe since bundling is happening with esbuild I could set:
But this resulted in the same outcome where the excess JS and CSS files were created.
What am I doing wrong?
Edit: this is happening with Sprockets too
Here's the same project but using Sprockets:
Is this possibly a Rails 8 change and has nothing to do with Propshaft? Unless I'm crazy (which is very possible), I don't recall all of these files being created in the past by Sprockets. Do we know why they're being created?
The text was updated successfully, but these errors were encountered: