Reputation: 1267
After review, this question has been asked many, many, many times. Yet I still don't grok why rake assets:precompile
fails.
I can view the following results from my browser using local server (e.g. thin):
body{
@include background-image(image-url('my_image.png'));
background-repeat: repeat;
...
...
}
(NOTE: image-path doesn't seem to work at all and I'm using thoughtbot bourbon as SCSS lib)
Yet every time I run precompile I get the following (short trace):
rake aborted!
images/my_image.png isn't precompiled
(in /path/to/myapp/app/assets/stylesheets/application.css.scss)
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
This post suggests that I change my production.rb file, which I did and it compiled my image and rake now complains that I have an undefined mixin 'border-radius'
. Perhaps this was the next exception, but I am not so sure. And everything works locally.
Rails Guides (3.1.3) explicitly states setting the value to true
'uses more memory, performs poorer than the default and is not recommended'
So now I have two problems. Performance downgrade and my SCSS library now has undefined mixins.
I would like to solve the production deployment issue resulting from rake assets:precompile
. My Gemfile asset group looks like this:
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'zurb-foundation'
gem 'bourbon'
end
Upvotes: 2
Views: 1944
Reputation: 1642
If you go with the assets:precompile option, you should use @import
statements in every stylesheet you use a mixin.
e.g.
Let's say you have a custom mixin in app/assets/stylesheets/partials/_mixins.css.scss
that you use in a stylesheet, you should add
@import "partials/mixins";
to that stylesheet.
I know, is shouldn't be like that, but as for now, I haven't found any other way.
Upvotes: 2
Reputation: 10493
The image-path helper assumes the images
part of the path so remove that (and the slash) and it should start working.
Upvotes: 0