Rails 3.1 Asset Pipeline - disable fingerprints on Heroku?

Since the jQuery plugin that I use in my application has a direct link to images, I am trying to disable asset fingerprints.

So, I set config.assets.digest = false in my production.rb, but now none of my image links work at all. /assets/foo.png just returns an empty response.

I really don't want to change the jQuery plugin code and add erb image helpers, but I'm not sure what else to do. And frankly, a fingerprint for images seems to have a lot more problems than it costs.

Does anyone have discernment?

Thanks!

+4
source share
2 answers

If you use a large plugin, for example, ckeditor, then your only real option is to move this plugin to a shared directory.

For small plugins, you can move your images to the correct resource path. For example, if your plugin refers to images/icon.jpg in the plugin folder, it will need to be moved to something like app/assets/images/plugin_name/icon.png , and then referenced in the plugin with <%= asset_tag('plugin_name/icon.png') %> .

The pipeline is standing. Not using digests in production makes it almost impossible to use it at all, which means that you need to set headers with a great future so that the resource is cached somewhere.

If you intend to remove digests, you must first arrange the assets (so that Sprockets do not serve them with headers with a large future header) and make sure that headers are not set on the server.

+1
source

Someone made a stone for this purpose:

https://github.com/spohlenz/digestion

The asset pipeline is a great new component of Rails 3.1. However, it does have a feature known as a fingerprint, which makes it impossible to correctly include many popular JavaScript libraries (including TinyMCE, CKEditor and FancyZoom, to name a few) in the asset pipeline.

This gem fixes an asset pipeline to allow these libraries to be used by disabling fingerprint functionality for specific files or paths.

+3
source

All Articles