Smart asset management for Rails plugins

Many Rails plugins require that certain files like images, CSS, and JavaScript get copied to the public folder during installation. The typical way to do this is add code to install.rb, which then gets executed when you first install the plugin in your Rails project. What happens when the assets in a plugin you’re using change, though? You end up having to manually copy files around anytime the plugin gets updated, which is an extremely error-prone process.

I extracted asset_copier from an existing Terralien project. It fixes this problem beautifully. Once installed, it keeps the assets in your Rails project synchronized with your plugin. It even deletes assets from the Rails project that have been removed in the plugin.

To learn more, check out this post. If instant gratification is more your thing, install the gem directly and apply it to your target plugin:

sudo gem install pelargir-asset_copier --source=
cd ~/some_rails_project
script/generate asset_copier some_plugin

One thought on “Smart asset management for Rails plugins

  1. Pingback: My Recommended Plugins for a Money Making Blog Site |

Comments are closed.