assets:precompile
작업의 이상한 동작이나 적어도 완전히 이해하지 못한 작업 앞에 나 자신을 발견했습니다.레일 에셋 : 이상한 동작을 사전 컴파일
그래서 웹 응용 프로그램에 Rails 3.1.3, Sprockets 2.0.3, Less 2.0.11을 사용하고 레이아웃에 부트 스트랩을 사용하므로 less-rails 2.1.8 이하도 사용하고 있습니다. -rails-bootstrap 2.0.8. here처럼 스타일을 사용자 정의했습니다.
내 자산의 구성은입니다 : application.css.scss에서
stylesheets
|--application.css.scss
|--custom-style/
|--variables.less
|--mixins.less
|--buttons.less
|--custom-style.css.less
내가 buttons.less
에
@import "twitter/bootstrap/reset";
//@import "twitter/bootstrap/variables"; // Modify this for custom colors, font-sizes, etc
@import "custom-style/variables";
//@import "twitter/bootstrap/mixins";
@import "custom-style/mixins";
// And all the other standar twitter/bootstrap imports...
// Other custom-style files to import
@import "custom-style/buttons"
//...
// And other rules here
//...
마지막으로 할
//=require custom-style
및 사용자 정의 스타일
을 나는variables.less
과
mixins.less
B에 정의 된 몇 가지 변수와 믹스 인을 사용합니다. 자세한 내용은
@white
및
.buttonBackground
입니다. 나는 위의 구성으로
bundle exec rake assets:precompile
를 시작하면
작업이 실패하고이 오류 얻을 :
$ bundle exec rake assets:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p0/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
.buttonBackground is undefined
하지만 내가 할 경우이
buttons.less --> buttons.css.less
@import "buttons" --> @import "buttons.css.less"
모든 것이 잘 작동 변경하는 것이입니다!
중첩 된 가져 오기로 작업 할 때 변수 및 함수가 적은 범위와 관련이 있습니까? 또는 더 적은 파서 또는 스프로킷이 가져 오기 트리를 처리하는 순서와 관련이 있습니다.
내가 누락되었거나 잘못된 방식으로 뭔가를하고 있습니까?
감사합니다 :)
참고 :이 난 원래 변수와 유지 mixin 파일로 오류가 발생, 그래서 그들로 수행 오버라이드 (override)과 연결되지 않은.
"나는 자산의 이상한 행동 앞에서 나 자신을 발견했다 : 사전 컴파일 작업"- 우리 모두는 그렇지 않다 :) 또한 application.css.scss와 .less 파일을 혼합하는 것이 발행물. 나는/LESS/SASS 중 하나를 시도해보고 싶을 것이고 Sass는 @import 지시어를 인식하지 못하고있을 것이다. 필요하지 않으므로 application.css.scss-> application.css를 변경하고 Gemfile에서 sass-rails를 제거하고 도움이되는지 확인하십시오. 행운을 빌어 요 :) – sbeam