开发者

How to serve static content from gems in Sinatra (analagous to Rails ::ActionDispatch::Static)

开发者 https://www.devze.com 2023-03-23 03:35 出处:网络
I have a Sinatra service which includes a gem.The gem contains some static content which I would like to include in and serve via the Sinatra app.

I have a Sinatra service which includes a gem. The gem contains some static content which I would like to include in and serve via the Sinatra app.

In Rails this would be done with ActionDispatch. Here is an example: http://jonswope.com/2010/07/25/rails-3-engines-plugins-and-static-assets/

Is there 开发者_高级运维a way to do this in Sinatra without ActionDispatch? Or is there a clean way to do it via ActionDispatch in Sinatra?


Sinatra is Rack Applications. An easy way to serve static files is with Rack::Static. More examples in this SO question.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号