jhilden / jquery-ui-sass-rails

jQuery UI stylesheets packed as Sass files for the Rails 3.1+ asset pipeline
Other
45 stars 28 forks source link

Image paths pointing to /images and not /assets in production #7

Open ajporterfield opened 10 years ago

ajporterfield commented 10 years ago

This is a continuation of an issue I initially brought up at https://github.com/joliss/jquery-ui-rails/issues/58#issuecomment-29900235.

In my local dev environment, this gem (as well as jquery-ui-rails) correctly produces image paths starting with /assets. In production, however, the images start with /images, and aren't being displayed (404s).

Here are some details about my setup.

I'm deploying with AWS' Elastic Beanstalk (Ruby 1.9.3, Rails 3.2.15). EB precompiles assets automatically after pushing changes via Git. I'm only interested in including jquery ui for the datepicker. My current work around for fixing the bad image paths in production is to override SASS variables (see https://github.com/jhilden/jquery-ui-sass-rails/blob/master/app/assets/stylesheets/themes/_jquery.ui.base.css.scss). Here's what my jquery.ui.custom.css.scss looks like that I'm importing.

$bgImgUrlContent: url("/assets/jquery-ui/ui-bg_flat_75_ffffff_40x100.png") !default;
$bgImgUrlHeader: url("/assets/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png") !default;
$bgImgUrlDefault: url("/assets/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png") !default;
$bgImgUrlHover: url("/assets/jquery-ui/ui-bg_glass_75_dadada_1x400.png") !default;
$bgImgUrlActive: url("/assets/jquery-ui/ui-bg_glass_65_ffffff_1x400.png") !default;
$bgImgUrlHighlight: url("/assets/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png") !default;
$bgImgUrlError: url("/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png") !default;
$iconsContent: url("/assets/jquery-ui/ui-icons_222222_256x240.png") !default;
$iconsHeader: url("/assets/jquery-ui/ui-icons_222222_256x240.png") !default;
$iconsDefault: url("/assets/jquery-ui/ui-icons_888888_256x240.png") !default;
$iconsHover: url("/assets/jquery-ui/ui-icons_454545_256x240.png") !default;
$iconsActive: url("/assets/jquery-ui/ui-icons_454545_256x240.png") !default;
$iconsHighlight: url("/assets/jquery-ui/ui-icons_2e83ff_256x240.png") !default;
$iconsError: url("/assets/jquery-ui/ui-icons_cd0a0a_256x240.png") !default;
$bgImgUrlOverlay: url("/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png") !default;
$bgImgUrlShadow: url("/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png") !default;

@import "jquery.ui.core";
@import "jquery.ui.theme";
@import "jquery.ui.datepicker";
jhilden commented 10 years ago

This seems like a pretty general setup issue witht he asset pipeline in your production environment. Are you using image_path/image-url anywhere else in your Sass?

Also it might make sense to take a look at the app.config.assets.paths config variable and see if there are any differences between development and production.

Also, maybe this new gem can help in you in finding the issue: https://github.com/schneems/sprockets_better_errors

But all in all, I fear that this is simply a setup issue and that there is nothing that I could fix in the gem.