简体   繁体   English

耙资产:预编译无法在本地编译

[英]rake assets:precompile does not work compiling locally

I just ran this on my QA and production server and it went perfectly. 我只是在我的质量检查和生产服务器上运行了它,它运行得非常完美。

rake assets:precompile

But when I run it locally, the trace responds fine. 但是当我在本地运行它时,跟踪响应良好。 I can tell it's accessing my database because of my .scss.erb file. 我可以确定由于我的.scss.erb文件正在访问数据库。 And that something happened , but when I reboot my server, and inspect my css file, no changes were actually made. 事情发生了 ,但是当我重新启动服务器并检查css文件时,实际上没有进行任何更改。

Additional notes : 补充笔记 :

My application.rb has -> 我的application.rb具有->

config.assets.initialize_on_precompile = true

The contents of colors.scss.erb colors.scss.erb的内容

<% Color.for_header.each do |color| %>
#super_header.color-<%= color.id %>, #eheader.color-<%= color.id %> {
  background-color: #<%= color.code %>;
  background-image: none;
}
<% end %>

<% Color.for_highlight.each do |color| %>
.lists-list.color-<%= color.id %> li {
  &.current a {
    &:before { background: url(/images/group-select-end-left/<%= color.image %>) no-repeat !important; }
    &:after  { background: url(/images/group-select-end-right/<%= color.image %>) no-repeat !important;}    
  }
  &.active, &.current {
    a {
      background-color: #<%= color.code %> !important;
      background-image: none !important;
    }
    &:before {
      background: url(/images/group-select-end-left/<%= color.image %>) no-repeat !important;
      left: -9px;
      height: 39px;
      width: 9px;      
    }
    &:after {
      background: url(/images/group-select-end-right/<%= color.image %>) no-repeat;
      right: -10px;
      width: 10px;
      height: 30px;
      top: 0;
    }
  }
}
<% end %>

Since rake loads all Rails stack, you probably need to add the environemnt: 由于rake加载了所有的Rails堆栈,因此您可能需要添加环境:

RAILS_ENV=your_env_name bundle exec rake assets:precompile

It works on my staging server (no heroku ) using capistrano . 它使用capistrano在我的登台服务器(不是heroku )上工作。

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

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