Note that there are some explanatory texts on larger screens.

plurals
  1. POIncluding large JS library with :cache => true into a rails app
    text
    copied!<p>I am thinking about the best way of including a JS library into rails app supporting <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#M001719" rel="nofollow noreferrer"><code>:cache =&gt; true</code></a> option for both JS and CSS.</p> <p>Let me take an example to describe the question: jQueryUI (that's just an example). It usually has the following structure when downloaded:</p> <pre><code>+jq.ui +css +skin1 +images all_the_images.png jq-ui.css +skin2 +images all_the_images.png jq-ui.css +js jquery.js jq.ui.js </code></pre> <p>Now in order to use it I have to include this structure into rails app (2 js files + 1-2 css). I need to be able to use <code>:cache =&gt; true</code> option (so that the jquery, jquery ui, application.js etc would be all in one file; also the jq.ui/skin2/jq-ui.css and application.css would be in a single file too).</p> <p>The problem with <code>:cache =&gt; true</code> is that the single (combined) CSS file will not reference the correct images as it will be moved to the <code>stylesheets</code> path instead of <code>stylesheets/jq.ui.css/skin2/jq-ui.css</code>. Thus broken links to images from the CSS.</p> <p>The question is:<br> <strong>Where the library like this should go in to the rails app?</strong> Should I <strong>reshuffle the structure</strong> to the default rails convention (and <strong>thus manually modify jquery ui css</strong> to fix image references) or use it as it is and <strong>combine all the files some other way</strong>?</p> <p>Thanks,<br> Dmitriy.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload