我以为我已经弄清楚了资产流水线,但现在没有了。
我有一个名为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目录中看到它。
任何想法都会有所帮助。
最佳答案
我相信您想要的是:
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;
}
关于ruby-on-rails-3.1 - 没有预编译file.png,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8048164/