ok, so I’m doing an upgrade on a rails 2.3.2 app to 3.1, and I’ve
noticed a lot of roadblocks with the asset pipeline. Luckily I’ve
figured them all out, but I’m wondering how everyone else is solving
these issues.
Let’s take a newly generated rails 3.1 app. I have a grid of squares
I want to click on, and have a modal window popup. I can //= require
jquery-ui in my app/assets/javascripts/application.js and that will add
in my model() method, but I can’t require the jquery-ui in my
application.css. It looks like no themes are included. (unless I’m
missing something).
I download a theme I would like to use, and in the stylesheets folder,
there’s a jquery-ui.css and an images folder. I added these into the
vendor/assets/stylesheets folder, and in my
app/assets/stylesheets/application.css.scss file I require jquery-ui,
and Sprockets can’t find it. I moved this file and it’s images folder to
the app/assets/stylesheets folder. Sprockets can now find the
stylesheet, but won’t load any of the images. The default
background-image: url() in this file is looking for
images/whatever.png). moving those images to the app/assets/images
folder doesn’t work either. I had to tack on .scss to the file, and then
global find an replace the background url stuff with
image-url(whatever.png), and now it all works.
IMO, 3rd party things should not be edited, or altered. Although, I’ve
been known to edit 3rd party stuff to make it fit, I just feel it’s bad
practice.
So, now I would like to know in situations like this, how are other
Rails developers handling this? Is there something I’m missing that
would have made this easier? Maybe a config option or something…