简体   繁体   English

Rails 3.1资产预编译问题

[英]Rails 3.1 assets precompile questions

Right now, every time I am changing something in the assets, I have to delete the assets folder from the public directory and then run rake assets:precompile to take effect. 现在,每次我更改资产中的某些内容时,我都必须从公共目录中删除assets文件夹,然后运行rake assets:precompile才能生效。

Is this something right or wrong so I should put it in a capistrano task to do it automatically? 这是对还是错,所以我应该把它放在capistrano任务中自动完成?

For some reason, it doesn't compile automatically the assets in production and it throws errors if I don't do the above (or it doesn't take effect the changes if there is the files already). 由于某种原因,它不会自动编译生产中的资产,如果我不执行上述操作,则会抛出错误(或者如果已经存在文件,则不会使更改生效)。 Is there something I should put in the environments/production.rb? 我应该在环境/ production.rb中添加一些东西吗?

Also I don't understand what the following code in the production.rb does: 另外我不明白production.rb中的以下代码是什么:

  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = true

I tried false and true but I didn't understand the difference. 我尝试了虚假和真实,但我不明白其中的区别。

I'm a bit confused as at how it should work the workflow in production, if what I am doing is right and about the settings for the assets in production. 我有点困惑,因为它应该如何工作生产中的工作流程,如果我正在做的是正确的,关于生产中的资产的设置。

Capistrano has built-in support for precompiling assets during deployment. Capistrano内置支持在部署期间预编译资产。 Just add this line to your deploy.rb file: 只需将此行添加到deploy.rb文件中:

load "deploy/assets"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM