加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 为什么要使用资产管道来提供图像?

发布时间:2020-12-16 19:39:32 所属栏目:百科 来源:网络整理
导读:在 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.ru
在 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

对我来说,这表示图像应该保留在公共目录中,因为我们的网络服务器可以静态地提供图像,并且不需要预处理.

将图像投入资产有什么优势吗?

解决方法

资产预编译器将唯一的哈希值附加到映像文件名,这样即使在服务器上有缓存或到期设置,用户也可以获得最新版本.当您想要更改网站设计中的图像时,这很有用.

您不想为图像使用/ assets / images,这不太可能改变(如用户上传).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读