rstacruz / sinatra-assetpack

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

CSS image url rewrite with cache buster won't work if controller is not mounted under root #141

Open marano opened 10 years ago

marano commented 10 years ago

If config.ru mounts a controller under a context, different from root, assetpack won't replace the URL in the css files with the cache buster bit. The reason for this is that assetpack internal "served" list doesn't include the context in the path.

Example:

# config.ru
map '/context' do
  run Controller
end
# controller.rb

class Controller < Sinatra::Base
  assets {
    serve '/img', :from => 'lib/img'
  }
end
// example.css
a {
  background-image: url( /context/img/a.png );
}
goozler commented 10 years ago

I have the same problem. Do you find any solution?

marano commented 10 years ago

@Goozler no, I had to mount everything under root and have the context path on the routes in the controller...

LichP commented 9 years ago

I'm having the same problem trying to run on a sub URI in Passenger.

j15e commented 9 years ago

There is a bunch of known issues with sub URI. This is mostly because sinatra-assetpack is not fully written as a rack middleware, it could and should be fix, but would require a lot of code rewrite.

See #16 and discussion in #68.