Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Adam,
cheers for writing this plugin, saved me heaps of time. I've added several things to it that you might find useful:
An easy way to specify the s3.yml filename since we use attachment_fu and we use its default of amazon_s3.yml.
An option to delete all other rev_*/* files in the bucket, we use Capistrano to do deploys and because of the way it versions releases on the server retrieving the last CDN revision isn't easy, but we still want a set and forget cleanup process. This could be dangerous if anything else is stored in the bucket with that naming scheme (we have a separate bucket for CDN stuff), so feel free to take this out if you don't like it, but still like the other changes ;).
You can now set metadata (in particular we needed the expires header) on the files.
You can specify another bucket that will have the same content as the main bucket, but with the css and js gzipped, to allow for browsers that support compressed content to have smaller downloads, this requires asset_host config to check whether or not the client supports, something like:
config.action_controller.asset_host = Proc.new { |source, request |
if request.headers['Accept-Encoding'] && request.headers['Accept-Encoding'].include?('gzip')
"gzip.cdn.foo.com"
else
"cdn.foo.com"
end
}
I've added to the documentation for the above (although I didn't include the above proc example since there are so many variations on how this should be done depending on cnames, gzipping and so on).
Chris