images in production subdirectory problem #54

Closed
naxels opened this Issue Sep 3, 2013 · 5 comments

Comments

Projects
None yet
3 participants
@naxels

naxels commented Sep 3, 2013

Thanks for the gem first of all, saved me a lot of time :)

I do have a bug however, in development all images are fine
where in production the images go wrong.

The reason for this is because in production I run in a subdirectory (have to)
the javascripts/stylesheets load perfectly as compiled:
http://www.example.com/app/assets/application-(fingerprint).(js/css)

however the jquery-ui images go wrong:
http://www.examples.com/assets/jquery-ui/ui-icons_888888_256x240-(fingerprint).png

while it should be
http://www.examples.com/app/assets/jquery-ui/ui-icons_888888_256x240-(fingerprint).png

notice the difference in the /app/ part

when however I manually go to the correct url, the jquery-ui assets are actually there, so no problems there.. only routing.

Thank you for fixing this!

@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Sep 3, 2013

Member

jquery-ui-rails just hands the asset paths off to Rails, using image_path and friends (example), so I think this is something you might have to configure in your Rails app.

Member

joliss commented Sep 3, 2013

jquery-ui-rails just hands the asset paths off to Rails, using image_path and friends (example), so I think this is something you might have to configure in your Rails app.

@naxels

This comment has been minimized.

Show comment
Hide comment
@naxels

naxels Sep 3, 2013

hmm, i'd have to verify how that works.

what i did in the past though for my own images in css files was always use:
url(<%= asset_data_uri 'logo.png' %>)

because it embeds the image and requires less roundtrips to the server for data
(and possibly explains why this is the first time encountering this error)

is it possible to use asset_data_uri in your gem, given that it's less round trips to the server
and all cached in the compiled assets?

naxels commented Sep 3, 2013

hmm, i'd have to verify how that works.

what i did in the past though for my own images in css files was always use:
url(<%= asset_data_uri 'logo.png' %>)

because it embeds the image and requires less roundtrips to the server for data
(and possibly explains why this is the first time encountering this error)

is it possible to use asset_data_uri in your gem, given that it's less round trips to the server
and all cached in the compiled assets?

@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Sep 3, 2013

Member

Using data URIs is tempting given the small image sizes, but I don't want to break things for people who need to be compatible with old IE and other obscure browsers.

Member

joliss commented Sep 3, 2013

Using data URIs is tempting given the small image sizes, but I don't want to break things for people who need to be compatible with old IE and other obscure browsers.

@joliss

This comment has been minimized.

Show comment
Hide comment
@joliss

joliss Oct 13, 2013

Member

I'm closing this issue. Feel free to leave a comment and I'll reopen.

Member

joliss commented Oct 13, 2013

I'm closing this issue. Feel free to leave a comment and I'll reopen.

@joliss joliss closed this Oct 13, 2013

@thoughtafter

This comment has been minimized.

Show comment
Hide comment
@thoughtafter

thoughtafter Jun 19, 2015

I ran into this today and in case anyone comes across this issue like I did:

The easiest fix is to set Rails.application.config.action_controller.relative_url_root in an initializer.

See YaleSTC/shifts#402

I ran into this today and in case anyone comes across this issue like I did:

The easiest fix is to set Rails.application.config.action_controller.relative_url_root in an initializer.

See YaleSTC/shifts#402

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment