Reputation: 821
In my Rails 4 project, I have this in my Gemfile
..
gem 'sass-rails', '~> 4.0.3'
gem 'compass-rails'
...this in my application.sass
file...
@import "compass"
...and this in my SASS style.sass
file...
.background
$image: asset-path("my-image.jpg")
background: url($image)
width: image-width($image)
height: image-height($image)
With the above code, I get this error in my browser...
Error compiling CSS asset, Type error: no implicit conversion of nil into String (in /Users/.../style.sass)
It seems that the Compass functions of image-width
and image-height
are not able to access the my-image.jpg
file. If I comment them out, I am able to get the image, but am unable to make use of its width & height using Compass. I would very much like to be able to use that Compass functionality. Thanks.
Upvotes: 0
Views: 1705
Reputation: 2166
Have you tried this?
.background
$image: "my-image.jpg"
background: image-url($image)
width: image-width($image)
height: image-height($image)
I think it is because compass' image-width and image-height already take into account the asset-pipeline. Have fun.
Upvotes: 1