I’m writing a library that has an embedded Sinatra app launched via Thor. I want to mount instances of Sprockets::Environment at /css and /js and have the main app mapped to /. This would be easy using Rack::URLMap in a config.ru file, but in this case there isn’t one because I’m starting the Sinatra app programmatically with Sinatra::Application.run!. How can I achieve this?
I’m writing a library that has an embedded Sinatra app launched via Thor. I
Share
I ended up doing it by writing a custom middleware with some of the functionality from
Rack::URLMap. It looks roughly like this: