I have created a route plus controller for doing dynamic css in ruby on rails as per the instructions here:
http://www.misuse.org/science/2006/09/26/dynamic-css-in-r
I used this for a general case when you don't know the extension:
get '/uploads/:basename.:extenstion', to: 'controller#action', basename: /.*(?=\.[\w\d]+$)/