rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 97 forks source link

Cache-Controls headers are not being applied to SVG images in css stylesheets. #163

Open kevinkurpe opened 10 years ago

kevinkurpe commented 10 years ago

I have successfully implemented sinatra-assetpack in my application with one exception: svg images in my css stylesheets.

Neither cache-control headers nor a cache-busting suffixes are being applied to svg images in my css stylesheets.

e.g.

background: url(/images/map.svg);

I should mention that svgs located in my erb templates load properly.

Any ideas?

j15e commented 10 years ago

Which version do you use? SVG support was added a long time ago in v0.0.11 but that might be your problem.

kevinkurpe commented 10 years ago

I'm using version 0.3.2

j15e commented 10 years ago

I have an exemple here with an SVG inside a CSS that works :

http://code.hooktstudios.com/css/application.4b394912e9f486980c222a6dd5071d25.css

You can browse source here : https://github.com/hooktstudios/code

Assets URL in CSS are being replace with cache-busting prefixes in this method, it may give you a hint why it does not work in your case :

https://github.com/rstacruz/sinatra-assetpack/blob/master/lib/sinatra/assetpack/css.rb#L6

Looking quickly at the regexp the ' or " should not be required, but maybe there is a bug, you should try writing url('/images/map.svg'); rather than url(/images/map.svg);