-
Notifications
You must be signed in to change notification settings - Fork 755
Fix(SprocketsRenderer) support Sprockets::Manifest if assets were precompiled #430
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
Conversation
e1898d5
to
7f43c2a
Compare
I think in most cases, doesn't the CDN just serve essentially as a caching layer, with the underlying Rails server still serving the assets (the first time)? At least in our setup with heroku/cloudfront, which I think is fairly common, we precompile assets so they're served via the Then when the first request comes in to cloudfront after a new deploy, the filename hash will have changed, so cloudfront will proxy through to our site, and then cache and serve the asset from then on.
This wouldn't exactly work for us, I don't think. We do have it set, but we still have the assets precompiled on the server as well, so maybe accessible to Sprockets? (I'm not 100% clear how sprockets works...). Just FYI. |
Yeah, I think I was off the mark on I was just poking around our own production environment, though, and I noticed that our assets aren't in |
Ug, looks like |
3e56d86
to
00b26e9
Compare
00b26e9
to
a2ef5ca
Compare
Fix(SprocketsRenderer) support Sprockets::Manifest if assets were precompiled
Previously,
SprocketsRenderer
would live-compile assets, even in production. However, this is impossible in Rails 5 (not just improper) because there is noSprockets::Environment
atRails.application.assets
.Instead, there is a
Sprockets::Manifest
atRails.application.assets_manifest
which tells where each file's compiled counterpart is.So, if the Sprockets::Environment isn't available, use the manifest.
TODO
Check for, no because that doesn't necessarily mean the files are remoteasset_host
config?get_asset_content
to classes