Rails 3.1 애셋 파이프 라인 사전 컴파일을 프로덕션 모드로 작동시킬 수 없습니다. 항상 같은 오류 SCSS 내에서 참조 영상에 실패Ruby on Rails 3.1 애셋 : 사전 컴파일 및 이미지
$ bundle exec rake assets:precompile RAILS_ENV=production
rake aborted!
rails.png isn't precompiled
(in /home/florian/AssetTest/app/assets/stylesheets/application.css.scss)
나는 공공/자산 디렉토리에서 볼 때, 이미지가를, 그래서 사전 컴파일 :
$ ls public/assets | grep rails
rails-dd352fc2630e5f9aa5685ef1d7fe5997.png
SCS들 나는 이미지의 URL SCSS에서 도우미, 그러나 다만 URL ('/ 자산/rails.png')를 사용하지 않는 경우
/*
* This is a manifest file that'll automatically include all the stylesheets available in this directory
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
*= require_tree .
*/
body {
background: #ffffff image-url('rails.png') no-repeat 0 center;
}
, 사전 컴파일은 잘 작동하고,이 경우 파일은 몇 가지 테스트 코드를 포함 manifest.yml 파일은 g입니다. 공공/자산에 적용됩니다.
재미있는 점은 SCSS를 image-url ('rails.png')으로 다시 변경하고 다른 프리 컴파일을 실행해도 이미지가 이미 매니페스트 파일에 이미 나열되어 있기 때문에 여전히 작동한다는 것입니다.
내가 뭘 잘못하고 있니? 난 정말 도우미 메서드를 무시하고 싶지 않아요. (올바른 사용법은 맞습니까?) 수동으로 매니페스트 파일을 만들지는 않을 것입니다 ...
github 문제에서 제안 된대로 Rails 3.1.1rc1로 바로 업데이트되고 작동합니다 :-) – fwalch
이 답변은 이러한 이유로 좋지 않습니다. http://stackoverflow.com/questions/8821864/config-assets-compile- 트루 - 인 - 레일 - 생산 - 이유가 아닌 – Ringo