Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get jQuery Mobile precompiled for Rails 3 production?
    text
    copied!<p>I'm trying to deploy a Rails 3 app which includes jQuery Mobile. It works fine in development, and I understand that it needs to precompile the JS and CSS for production. I'm getting the following error:</p> <pre><code>Started GET "/orders/mobile" for 127.0.0.1 at Wed Jun 06 14:22:40 -0400 2012 Processing by OrdersController#mobile as HTML Rendered orders/mobile.html.erb within layouts/mobile (642.9ms) Completed 500 Internal Server Error in 1122ms ActionView::Template::Error (jquery.mobile isn't precompiled): 5: &lt;head&gt; 6: &lt;meta http-equiv="content-type" content="text/html;charset=UTF-8" /&gt; 7: &lt;title&gt;Company Orders&lt;/title&gt; 8: &lt;%= stylesheet_link_tag 'jquery.mobile' %&gt; 9: &lt;%= stylesheet_link_tag 'jquery.mobile.structure' %&gt; 10: &lt;%= stylesheet_link_tag 'jquery.mobile.theme' %&gt; 11: &lt;%= stylesheet_link_tag 'http://fonts.googleapis.com/css?family=Ubuntu' %&gt; app/views/layouts/mobile.html.erb:8:in `_app_views_layouts_mobile_html_erb__605278794_69818059003840' app/controllers/orders_controller.rb:330:in `mobile' app/controllers/orders_controller.rb:329:in `mobile' </code></pre> <p>I've read the <a href="http://guides.rubyonrails.org/asset_pipeline.html#manifest-files-and-directives" rel="nofollow">usual</a> stuff, but there are so many things wrong here, I hardly know where to start:</p> <ol> <li>I had the JQM stuff in app/assets, but have since moved them to vendor/assets. They get seen by the precompiler -- I know because it will complain about them on various tries -- but they never seem to get precompiled (in either location).</li> <li>I've tried <code>*= require_tree ../../../vendor/assets/stylesheets</code> in application.css. I don't really want it included in every page hit, so I'd like to include it in the layout, but I'm just trying to get it precompiled somehow.</li> <li>I've tried <code>*= require jquery.mobile[[.css].erb]</code> in application.css.</li> <li>I've tried <code>config.assets.precompile += %w( [[./]vendor/assets/stylesheets/]jquery.mobile.* )</code> in config/environments/production.rb.</li> </ol> <p>As a last-ditch effort, I've removed the ".erb" from jquery.mobile.css.erb, and removed the <code>&lt;% asset_data_uri %&gt;</code> tags to see if it would compile. It passes the <code>rake assets:precompile</code> command, but <em>still</em> gives me the same error.</p> <p>I don't want to turn off precompiling for JQM; I <em>want</em> it to work. (I really need to speed this page up.) However, I can't find any guide on how to get JQM elegantly inserted into a Rails 3 app (with precompiling), and I've exhausted every avenue I can think of in trial and error. Surely someone has done this and knows the right way to go about it.</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