I recently acquired a large HTML5 theme and did some work to launch it in a rails project and use the asset pipeline. There was some extensive search / replace that I had to do to enjoy the graphic URLs. Here is the general approach I used:
- Put all the provided "image" files and directories in / Seller / assets / images.
- Place all attached stylesheets / Supplier / assets / stylesheets
- Put all of the supplied javascript under / Provider / Assets / JavaScripts
Using the above approach, all relative paths should be maintained as the provider desired them. For example, my theme author had all the images in the "img" directory, so I just copied this directory to be / vendor / assets / images / img / ...
Now we need our application.css and application.js files to load the necessary files correctly:
- in /app/assets/javascripts/application.js add lines to add all the javascript that you think the theme provider offers you.
- in /app/assets/stylesheets/application.css add the lines needed to add all stylesheets
Now the tricky part depends on whether your javascripts and style sheets are included in other elements. For any files that did this, I recommend that you rename them to .erb (add .erb to the file name), which allows you to use rail assistants, such as the resource path and folder_image
.i24_arrow-180{ background-image: url(<%= asset_path 'img/icons/packs/fugue/24x24/arrow-180.png' %>); }
Or, in your javascript:
'<%= asset_path('js/mylibs/charts/jquery.flot.orderBars') %>':
After you've fixed any image paths, you should be ready to move on to the new theme, and it will work with the Asset pipeline!
Warning: I spent several hours debugging the problem of compiling assets with a theme, and it turned out that it was because one of the images had a bracket in the file name, and the sass compiler tied it up!
source share