我以为我已经找到了资产管道,但现在已经没有了。
我有一个名为clients.css.scss的样式表
.client
{
.list_view
{
width: 650px;
height: 500px;
overflow: auto;
table
{
width: 650px;
border: solid 2px #999999;
border-collapse: collapse;
thead tr
{
background: image-url('list-view-header.png') repeat-x;
}
thead tr:first-child
{
background-image: none;
}
}
}
}
每次我尝试在生产中预编译时,我都会收到“file.png未预编译”错误。
bundle exec rake assets:precompile RAILS_ENV=production --trace
/usr/local/rvm/gems/ruby-1.9.2-p290@pm/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/gems/ruby-1.9.2-p290@pm/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_
rake aborted!
list-view-header.png isn't precompiled
(in /var/rails/pm.onlinetherapy.com/app/assets/stylesheets/clients.css.scss.erb)
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
图像文件位于app / assets / images目录中,我可以在public / assets目录中看到它,并带有扩展的指纹名称。
任何想法都会有所帮助。
答案 0 :(得分:1)
我相信你想要的是这个:
thead tr
{
background: image-url('/assets/list-view-header.png') repeat-x;
}
或者您可以将clients.css.scss更改为clients.css.scss.erb并执行此操作:
thead tr
{
background: image-url(<%= asset_path "list-view-header.png" %>) repeat-x;
}