Tim Morton
Tim Morton

Reputation: 2644

Rails 4 asset pipeline and image placement No route matches [GET] "images/ui-icons_444444_256x240.png"

I'm using the download builder for jquery ui to generate a CSS file. For CSS rules such as:

#ui-datepicker-div .ui-widget-content .ui-icon {
    background-image: url("images/ui-icons_444444_256x240.png");
}

The generated css is looking for images/ui-icons_444444_256x240.png, but that doesn't work with the asset pipeline.

I've tried putting the images in public/images and assets/images, but that still doesn't change the fact that rails will always barf on trying to find /images/ui-icons_222222_256x240.png. (error is No route matches [GET] "images/ui-icons_444444_256x240.png")

So where am I supposed to put the images??

Upvotes: 0

Views: 435

Answers (1)

luissimo
luissimo

Reputation: 978

If you can change the generated css put your images inside public/images and change

#ui-datepicker-div .ui-widget-content .ui-icon {
    background-image: url("images/ui-icons_444444_256x240.png");
}

to

#ui-datepicker-div .ui-widget-content .ui-icon {
    background-image: url("/images/ui-icons_444444_256x240.png");
}

Using a relative path will solve your problem.

Upvotes: 1

Related Questions