I'm trying to make sure that I'm serving compressed css and js files using Rails asset pipeline. I've set it all up nicely and things are precompiling happily - and also syncing happily to S3 where I'm serving them using Amazon's CloudFront CDN.
I'm serving the application.css and application.js like so:
= stylesheet_link_tag "application"
= javascript_include_tag "application"
The problem, in a nutshell: The MD5-suffixed files are not being output in the application layout - only the raw application.css and application.js
This gets a bit stranger: all of the images have an MD5 stamp. The CSS/JS files do not.
Here's my production.config:
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
config.assets.compress = true
# Fallback to compile on demand
# config.assets.compile = true
#config.assets.precompile += %w(application.css application.js)
# Generate digests for assets URLs
config.assets.digest = true
#push the assets to amazon
config.action_controller.asset_host = Proc.new { |source, request|
if request.ssl?
"https://tekpub-assets.s3.amazonaws.com"
else
"http://tekpub-assets.s3.amazonaws.com"
end
}
config.serve_static_assets = false
The infuriating thing about this whole process is that I can see the gzipped/digested files - they're right there in my assets directory. All of em - the CSS and JS files as well.
However my manifest.yml file is only updated like so:
---
application.js: application.js
application.css: application.css
There are no errors when I run precompile - in fact everything looks rather peachy:
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke