Rails 4 Assets.precompile [英] Rails 4 assets.precompile
本文介绍了Rails 4 Assets.precompile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是这里的一个常见问题,但是没有一种解决方案可以解决我的问题,所以就这样:
This is a common question in here, but none of the solutions fixed my problem, so here it goes:
我正在将ace.js添加到我的rails4应用程序中,所以我所做的是
I am adding ace.js to my rails4 app, So what I did was
- Added vendor/assets/ace/ace.js
- Created vendor/assets/ace/index.js , with content
//= require ace
- Added the following to my production.rb
config.assets.precompile += %w( index.js )
config.assets.paths << Rails.root.join("vendor", "assets", "ace")
所以在我的布局文件中,我有:
So in my layout file I have:
<%= javascript_include_tag "ace" %>
它在dev上正常工作,但是当我运行时:
and it works just fine on dev, but when I run:
RAILS_ENV=production bundle exec rake assets:precompile
它不会创建ace文件的摘要版本.
It doest not create the digest version of the ace file.
我错过了什么吗?
推荐答案
通过添加:
config.assets.precompile += %w( index.js )
到config/application.rb
. (不是config/environments/production.rb
)
在Rails 4.0 beta1中进行了测试.
Tested in Rails 4.0 beta1.
这篇关于Rails 4 Assets.precompile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文