views:

25

answers:

1

As the quantity of our pages increases, the number of images in the rails project has increased greatly. Does anyone have a good strategy for keeping track of these images?

We have experimented with a couple ideas but nothing seems to solve everything. Here are the high level requirements we have come up with:

  • Images should be available to any developer locally (given they have code access).
  • Updated images can be automatically sent to amazon s3 (and out to cloud front) on deploy
  • An easy way to "expire" an image when it changes forcing browsers to download instead of using a cached version
+1  A: 

We actually deployed a Rake Task to archive this and keep all the files between our application and (in our case) Cloudfiles in sync.

The rake tasks checks for new files or files that have been changed and uploads them to Cloudfiles. If a developer adds an asset, they can just run the rake task and update the cloud. They also check in the file into our version control so other dev's have access to it.

Max Schulze
What do you do to force cache expiry? Anything?
ChrisH
Our Rails App does that automaticly with adding the ?12234556 timestamp at the end.
Max Schulze
Right but what about for background-images in css/sass? We use a ton of sprites rather than individual files.
ChrisH
Yes that is a problem, but if you use Sass you could implement a function that adds a timestamp when the sass file is compiled? So on deploy the sass file is compiled once so the timestamp refreshes each deploy.
Max Schulze
Ahhh. I like that. Going to think about it further but I had not considered that yet.
ChrisH
Glad you liked it ;-)
Max Schulze