简体   繁体   中英

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. And that something happened , but when I reboot my server, and inspect my css file, no changes were actually made.

Additional notes :

My application.rb has ->

config.assets.initialize_on_precompile = true

The contents of 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:

RAILS_ENV=your_env_name bundle exec rake assets:precompile

It works on my staging server (no heroku ) using capistrano .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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