avdgaag/nanoc-cachebuster — pull request #19 by ovaskevich (2014-06-03 19:33:11+00:00)
Title: Match retina images

In my nanoc project, I need to use retina images (same image ending with @2x by convention, for use with Retina.js/a compass mixin). This is my rule:

route %r{/(images)/*/} do
# cache-bust images
if item.identifier.chop.end_with?('@2x')
item.identifier.chop[0..-4] + fingerprint(item[:filename]) + '@2x.' + item[:extension]
else
item.identifier.chop + fingerprint(item[:filename]) + '.' + item[:extension]
end
end

I needed to modify the CSS strategy to allow for matching Retina images. I'll try to write a cucumber test if I have time, but I'm on Windows at the moment and rspec doesn't like to play well on here. :(