Joe
Joe

Reputation: 86

Rails 3.1 app in subdirectory, asset paths not generating correctly in my sass file

I have a rails 3.1 app deployed in a subdirectory (/customers) on Apache+Passenger, using this method http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rails_to_sub_uri

In /app/assets/stylesheets/app.css.erb this code

background: url(<%=image_path("top.jpg")%>)

generates

background: url(/assets/top.jpg)

instead of /customers/assets/top.jpg

In my views,

image_path("top.jpg")

will generate

/customers/assets/top.jpg 

like I expect.

Any ideas?

Upvotes: 1

Views: 326

Answers (2)

Michael K Madison
Michael K Madison

Reputation: 2209

background: image-url("top.jpg")

should work after renaming to .css.scss

Upvotes: 0

Richard Hulse
Richard Hulse

Reputation: 10493

You should use asset_path inside your CSS instead of image_path.

Upvotes: 1

Related Questions