Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My fundamental problem here is that I need to have some assets precompiled for production, but NOT included in every page hit. Here's what I've figured out:</p> <p>If I didn't mind JQM being served with every page, I could either put the files in app/assets and let <code>require_tree .</code> do its magic, or leave those files in vendor/assets, and <code>require</code> them individually in application.js. If I want to put them in vendor/assets and NOT specifically require them in application.js, I can use <code>config.assets.paths &lt;&lt; "#{Rails.root}/vendor/assets"</code> in production.rb, and (apparently) <code>require_tree</code> in application.js will process this tree as well. This still rolls them up into the compiled application JS "ball," but leaves them distinct on the filesystem.</p> <p>The proper way to incorporate jQuery Mobile for <em>specific</em> pages -- and keep its files <em>separated</em> in vendor/assets -- <em>seems</em> to be to use both a <code>config.assets.paths &lt;&lt; "#{Rails.root}/vendor/assets"</code> directive <em>and</em> a <code>config.assets.precompile += %w( jquery.mobile.* )</code> directive. This will get the JQM files precompiled, but NOT rolled up into application-(hash).js and application-(hash).css. (They'll be individual files in public/assets.) Then you can do specific <code>javascript_include_tag</code>'s and <code>stylesheet_link_tag</code>'s in a layout specially for mobile views.</p> <p>Big finish: I had upgraded to Rails 3.2.5 because I saw some security report on 3.2.3. I rolled back to 3.2.3 and -- incorporating what I learned above -- I was able to finally get it working. I also tried 3.2.4. Apparently there's a regression in > 3.2.3 that interferes with precompiling.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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