4

I'm working with Rails 3.1's asset pipeline and although it seems to work flawlessly in my development environment on my localhost, I'm having huge issues with it on engine yard.

Here's my basic problem.

When I include images for a background in one of my scss files:

      a {
        color: #3c7f8b;
        font-weight: bold;
        padding-left: 35px;
        font-size: 13px;
        display: block;
        background: white url(shade.png) top right;
        &:hover {
          color: #222222;
          background: white url(shade2.png) top right; }
        &.on {
          color: #222222;
          background: white url(shade2.png) top right; } } }

I run into the following issues: Even though I have precompiled my assets, the browser requests /assets/shade.png instead of /assets/shade-FINGERPRINT.png which is the actual file that exists.

Does anybody know what I can fix this issues with referencing images in my assets folder inside my .scss files?

user229044
  • 232,980
  • 40
  • 330
  • 338
TheDelChop
  • 7,938
  • 4
  • 48
  • 70
  • some documentation on asset pipeline is in beta, some good stuff in there - http://ryanbigg.com/guides/asset_pipeline.html – house9 Jul 14 '11 at 15:56
  • It turns out it was actually a problem with my deployment strategy rather than the actual asset pipeline. – TheDelChop Jul 16 '11 at 02:42
  • @TheDelChop, Can you post the details of the issue with your deployment strategy? – mandreko Aug 29 '11 at 13:57

3 Answers3

4

You should use image-url rather than url to reference images when using scss in Rails 3.1.

Also, ensure you load compass before sass-rails, as sass-rails over-rides the asset methods to work with the asset pipeline.

Lastly, if you're using capistrano to deploy, add in

load 'deploy/assets'

To enable asset compilation when you deploy.

qnm
  • 521
  • 3
  • 14
2

Check out the answer from 'tybro0103' on this post - Rails 3.1 and Image Assets

basically change the file from scss to scss.erb and then use the asset_path helper method

pre-compile before deploy

disclaimer: i have not tried this myself

Community
  • 1
  • 1
house9
  • 20,359
  • 8
  • 55
  • 61
-1

qnm Actually I think there is an error with the image_url helper. Not sure if they fixed it but I saw a recommendation to use asset_url with the "image" explicting stated.

i.e. asset_url("some.img","image)

engineerDave
  • 3,887
  • 26
  • 28