开发者

Rails: routes for static resources

开发者 https://www.devze.com 2023-03-14 09:06 出处:网络
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.

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

精彩评论

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