我想使用//= require <lib>
与/app/assets/javascripts/application.js
. 这会导致资产编译错误,但问题是路径不正确。我做了一个简化的项目,显示https://github.com/rusanu/test-ember上的问题。
在布局中:
<head>
<title>TestEmber</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= yield :head %>
<%= csrf_meta_tags %>
</head>
在视图中:
<%= content_for :head do %>
<%= javascript_include_tag "dashboard/dashboard", :cache => 'dashboard' %>
<% end %>
在我的仪表板/dashboard.js中:
//= require handlebars
//= require ember
//= require ember-data
//= require_self
这会导致错误:
Showing /home/rremus/test-ember/app/views/dashboard/show.html.erb where line #2 raised:
No such file or directory - Asset file not found at '/home/rremus/test-ember/public/home/rremus/.rvm/gems/ruby-2.0.0-p0/gems/handlebars-source-1.0.0.rc4/dist/handlebars.js'
Extracted source (around line #2):
1: <%= content_for :head do %>
2: <%= javascript_include_tag "dashboard", :cache => 'dashboard' %>
3: <% end %>
4:
5: <h1>Dashboard#show</h1>
请注意资产路径如何由项目公共目录 ( /home/rremus/test-ember/public
) 组成,然后/home/rremus/.rvm/...
附加正确的资产路径 ( ),从而导致路径不正确。