Rails指南 here说 “Any assets under public will be served as static files by the application or web server when config.serve_static_files is set to true. You should use app/assets for files that must undergo some pre-processing before t
“Any assets under public will be served as static files by the
application or web server when config.serve_static_files is set to
true. You should use app/assets for files that must undergo some
pre-processing before they are served.”
我正在使用Rails 4.2.4.没有公共/资产文件夹.这让我想知道一些事情:
>“将app / assets用于必须在服务之前进行一些预处理的文件”是什么意思?
>预处理是什么意思?
>静态资产与其他资产的不同之处是什么?使用一个管道而不是另一个管道的性能优势是什么?
>如果4.2.4没有公共/资产文件夹,我甚至需要担心吗?
>我相信1已经回答了这个问题.
>如同1中所述,在生产过程中通过转发器/缩小器等传递每个资产将非常昂贵且浪费 – 因为这些资产不会动态变化,我们可以在预编译期间执行一次,并让静态文件服务器或cdn处理它们交货.
>在部署中预编译资产时,编译的文件将生成到public / assets文件夹中.
我建议阅读this article,它详细解释了资产管道.