gpt4 book ai didi

ruby-on-rails - 为什么我应该使用 Asset Pipeline 来提供图像?

转载 作者:行者123 更新时间:2023-12-04 00:58:57 24 4
gpt4 key购买 nike

在 Assets 管道的 Ruby on Rails 指南中,它说

Any assets under public will be served as static files by the application or web server. You should use app/assets for files that must undergo some pre-processing before they are served.



http://guides.rubyonrails.org/asset_pipeline.html

对我来说,这意味着图像应该保存在公共(public)目录中,因为它们可以由我的 Web 服务器静态提供,并且不需要预处理。

将图片放入 assets/ 有什么好处吗? ?

最佳答案

Assets 预编译将唯一的哈希值附加到图像文件名,这允许用户获取最新版本,尽管服务器上的缓存或过期设置。当您想在网站设计中更改图像时,这很有用。

你不想使用 /assets/images对于不太可能改变的图像(如用户上传)。

关于ruby-on-rails - 为什么我应该使用 Asset Pipeline 来提供图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10952876/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com