为什么Rails预编译任务会做非消化资产 [英] Why does rails precompile task do non-digest assets

查看:57
本文介绍了为什么Rails预编译任务会做非消化资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我这样做时: 佣金资产:预编译RAILS_ENV =生产 例如,我在public/assets文件夹中得到以下文件:

When I do: rake assets:precompile RAILS_ENV=production I get for example the following files in my public/assets folder:

  • application-7af6c31514bcdd4cce3c96892af4487f.js
  • application-7af6c31514bcdd4cce3c96892af4487f.js.gz
  • application.js
  • application.js.gz

最后两个是一个问题,因为它导致编译后的版本可以在开发中使用,而我不明白为什么会生成它们.

The last 2 are a problem because it causes the compiled version to get served in development and I don't understand why they are being generated.

在production.rb中有以下一行:

I have the following line in my production.rb:

config.assets.digest = true

推荐答案

要停止创建供公众使用的非哈希文件名:

To stop the creation of the non-hashed filenames in public use:

rake assets:precompile:primary RAILS_ENV=production

这篇关于为什么Rails预编译任务会做非消化资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆