Thanks for the responses guys!

So the answer to my original question:

> Is there a way to have the CSS and the images packaged as assets> without 
> modifying the CSS to use the asset_path helper?

...is no, there's no simple way to place the files in the assets
pipeline and have the images match up to the unmodified image links in
the CSS.

Options are:

* In the assets pipeline:
    * Find and replace the image links in the CSS with the appropriate helpers.
    * Write a sprockets processor to convert bare url(path) to
url(asset-path-with-hash). It should ideally restrict itself to a
given vendor directly (for jQueryUI in this case). It could be
packaged as a gem.
    * Use rake assets:precompile:nondigest in production, so it works
like in dev, without the image filename hashes that break the original
CSS.

* Outside of the assets pipeline:
    * Load everything from a CDN (e.g.
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/smoothness/jquery-ui.css)
instead of using a local copy.
    * Just put CSS and images in their own directory under public/,
and add an extra stylesheet link in the HTML (this is what I did).

Cheers,
Chris


On Wed, Oct 26, 2011 at 3:45 PM, Chris Berkhout <[email protected]> wrote:
> Hi All,
>
> I've got a Rails 3.1 app, and I've just started using the jQuery UI
> plugin's datepicker.
>
> I'm getting the javascript code out of the jquery-rails gem, by adding
> (to app/assets/javascripts/application.js):
> //= require jquery-ui.min
>
> For the theme/style, I generated one on jqueryui.com, and added the
> CSS file here:
> app/assets/stylesheets/jquery-ui-datepicker.smoothness.css
>
> My problem is with the images.
>
> Putting them under app/assets/stylesheets/images/* worked in
> development, but in production (when MD5 hashes get added) it doesn't
> work.
>
> With the CSS going into /assets/application.css, it's expecting its
> images to be under /assets/images/*.
>
> Is there a way to have the CSS and the images packaged as assets
> without modifying the CSS to use the asset_path helper?
>
> The only solution I can see at the moment is to put CSS and images
> under /public and manually link to the stylesheet in my application
> layout.
>
> Cheers,
> Chris
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to