开发者

Rails: routes for static resources

I have css/html content with js for script paths and css for stylesheets, but my scr开发者_如何学运维ipts are in javascript files and styles in stylesheets paths.

how do i configure routes.rb to map all img requests to images folder, js to javascripts folder and css requests to stylesheets folder ?


Rails, and therefore the routes.rb file is not involved with serving static assets. In development a rack middleware exists that serves the file if it exists in your projects /public directory. So when a request comes in for /images/foo.png, it will look in public/images/ for foo.png and serve it up if it exists.

If you are using the Rails view helpers for static assets, then you will already have the proper output URLs that will map to public/images, public/stylesheets and public/javascripts

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜