Wasabi Developer
Wasabi Developer

Reputation: 3553

Rails 4 Asset Pipeline and referencing images in SCSS

I'm checking out Rails 4 beta and when I deploy using Capistrano (Nginx, Unicorn, Postgres) it deploys the assetss successful with the manifest.

eg. logo-515b878aa9fea59fa353f24f11c3ab.png but I have noticed it doesn't also upload the original file logo.png (without the manifest).

I wanted to know if this is normal behaviour or is there something I'm missing.

And how do I call thie 'logo.png' file in the CSS file since the following doesn't work because it's not using the manifested file.

// Pages.SCSS file
.logo {
 background: url("logo.png") no-repeat scroll 0% 0%;
}

or

// Pages.SCSS file
.logo {
 background: url(image_path("logo.png")) no-repeat scroll 0% 0%;
}

Many thanks.

Upvotes: 3

Views: 2023

Answers (2)

Dmitriy
Dmitriy

Reputation: 341

Its a kind of rails bug, found the answer here

rake assets:precompile RAILS_ENV=production

Upvotes: 3

Wasabi Developer
Wasabi Developer

Reputation: 3553

My issues related to not using image_path or image_url (stopped using explicit calls to the image file within the css file). It solved my problem after a restart of the unicorn process (I thought my Capistrano recipe would of restarted the server after a cold deploy).

Thanks again.

Upvotes: 0

Related Questions