编译CSS资产时出错

时间:2012-03-05 05:12:31

标签: ruby-on-rails asset-pipeline ruby-on-rails-3.2

当我加载网页时,我发现错误和

Started GET "/assets/application.css" for 127.0.0.1 at 2012-03-05 10:07:42 +0530
Error compiling asset application.css:
NoMethodError: undefined method `[]' for nil:NilClass
  (in /Users/ritvvijparrikh/Projects/tr/app/assets/stylesheets/tr/sprites.css.scss)
Served asset /application.css - 500 Internal Server Error

我的文件sprites.css.scss很长时间没有改变。但后来我最近升级到Rails 3.2.2

我的sprites.css.scss文件是

/* Public Area Sprites */
.public_sprites {
  background: asset-url('public_area.jpg', image) no-repeat top left;
}

.sprite-aws{ background-position: 0 0; width: 159px; height: 58px; display: inline-block }
.sprite-gr{ background-position: 0 -108px; width: 111px; height: 91px; display: inline-block }
.sprite-hn{ background-position: 0 -249px; width: 111px; height: 91px; display: inline-block }
.sprite-i1{ background-position: 0 -390px; width: 28px; height: 30px; display: inline-block }
.sprite-i2{ background-position: 0 -470px; width: 28px; height: 30px; display: inline-block }
.sprite-i3{ background-position: 0 -550px; width: 28px; height: 28px; display: inline-block }
.sprite-i4{ background-position: 0 -628px; width: 28px; height: 28px; display: inline-block }
.sprite-kb{ background-position: 0 -706px; width: 112px; height: 92px; display: inline-block }
.sprite-nb{ background-position: 0 -848px; width: 111px; height: 91px; display: inline-block }
.sprite-pk{ background-position: 0 -989px; width: 111px; height: 91px; display: inline-block }
.sprite-postmark{ background-position: 0 -1130px; width: 171px; height: 35px; display: inline-block }
.sprite-rd{ background-position: 0 -1215px; width: 111px; height: 91px; display: inline-block }
.sprite-rp{ background-position: 0 -1356px; width: 111px; height: 91px; display: inline-block }
.sprite-sb{ background-position: 0 -1497px; width: 111px; height: 91px; display: inline-block }
.sprite-seal{ background-position: 0 -1638px; width: 119px; height: 45px; display: inline-block }
.sprite-slider1{ background-position: 0 -1733px; width: 500px; height: 320px; display: inline-block }
.sprite-slider2{ background-position: -550px 0; width: 500px; height: 320px; display: inline-block }
.sprite-slider3{ background-position: -550px -370px; width: 500px; height: 320px; display: inline-block }
.sprite-sr{ background-position: -550px -740px; width: 112px; height: 92px; display: inline-block }
.sprite-track_big{ background-position: -550px -882px; width: 415px; height: 304px; display: inline-block }
.sprite-trustlaw{ background-position: -550px -1236px; width: 216px; height: 72px; display: inline-block }
.sprite-unknown{ background-position: -550px -1358px; width: 74px; height: 74px; display: inline-block }
.sprite-vm{ background-position: -550px -1482px; width: 111px; height: 91px; display: inline-block }



/* Contact Sprites */
.contact_sprites {
  background: asset-url('contact.png', image) no-repeat top left;
}
.sprite-email{ background-position: 0 0; width: 17px; height: 17px; display: inline-block }
.sprite-facebook{ background-position: 0 -67px; width: 17px; height: 17px; display: inline-block }
.sprite-linkedin{ background-position: 0 -134px; width: 17px; height: 17px; display: inline-block }
.sprite-mobile{ background-position: 0 -201px; width: 17px; height: 17px; display: inline-block }
.sprite-phone1{ background-position: 0 -268px; width: 17px; height: 17px; display: inline-block }
.sprite-phone2{ background-position: 0 -335px; width: 16px; height: 13px; display: inline-block }
.sprite-skype{ background-position: 0 -398px; width: 17px; height: 17px; display: inline-block }
.sprite-twitter{ background-position: 0 -465px; width: 17px; height: 17px; display: inline-block }
.sprite-website{ background-position: 0 -532px; width: 17px; height: 17px; display: inline-block }
.sprite-youtube{ background-position: 0 -599px; width: 17px; height: 17px; display: inline-block }

/* Login Area Sprites */
.login_sprites {
  background: asset-url('login_area.png', image) no-repeat top left;
}
.sprite-calendar_39x39{ background-position: 0 0; width: 39px; height: 39px; display: inline-block }
.sprite-deletex{ background-position: 0 -89px; width: 17px; height: 17px; display: inline-block }
.sprite-off{ background-position: 0 -156px; width: 95px; height: 27px; display: inline-block }
.sprite-on{ background-position: 0 -233px; width: 94px; height: 27px; display: inline-block }
.sprite-status_gray{ background-position: 0 -310px; width: 12px; height: 13px; display: inline-block }
.sprite-status_green{ background-position: 0 -373px; width: 12px; height: 13px; display: inline-block }
.sprite-status_red{ background-position: 0 -436px; width: 12px; height: 12px; display: inline-block }
.sprite-status_yellow{ background-position: 0 -498px; width: 12px; height: 13px; display: inline-block }

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。我按照这篇文章中描述的配置解决了这个问题:

http://blog.55minutes.com/2012/01/getting-compass-to-work-with-rails-31-and-32/

就我而言,问题是我没有将application.css重命名为application.scss。