Steve Ng
Steve Ng

Reputation: 1189

How does vendor/assets stylesheet find vendor/img images

Bbootstrap.css is inside vendor/assets/stylesheets/ and inside bootstrap.css, there's this line,

dropdown-submenu:focus > a > [class*=" icon-"] {
  background-image: url("../images/glyphicons-halflings-white.png");
}

However, my ruby on rails app is complaining

GET http://localhost:3000/images/glyphicons_halflings-white.svg 404 (Not found)

How do I get it found? glyphicons_halflings-white.svg is inside vendor/assets/img

Upvotes: 0

Views: 202

Answers (1)

coreyward
coreyward

Reputation: 80090

Use image-url inside your stylesheet and Rails will ensure the proper path is used. If you don't use that helper, you will have nothing but broken images in production when asset fingerprinting is employed.

In this case, the correct URL is /assets/glyphicons_halflings-white.svg. Again, though, that will not be the case in production.

Upvotes: 1

Related Questions