Reputation: 38359
What the going "best practice" for serving both mobile & desktop browsers from a Rails application?
I'm not talking about custom apps on the mobile side but, mainly (entirely?!?), mobile Webkit.
I watched Railscast 199 which shows a technique of rendering and returning different views depending on whether the browser is mobile or not. Wondering if this is still preferable? What about just offering different CSS (assuming the content is largely the same)? Ideally the solution could take advantage of one of the mobile JQuery libraries (JQuery Mobile, JQTouch, Sencha Touch, etc.) How would things be handled through the asset pipeline?
Upvotes: 3
Views: 935
Reputation: 1095
Mobile_fu is still a great way to do it.
You'll need a separate layout file. For my apps which serve up both versions, I have separate JS and CSS folders at /assets/application & /assets/mobile.
I've had good luck with JQuery Mobile, but I've heard good things about Sencha too so that's probably personal preference.
Upvotes: 1
Reputation: 2505
Since you mention mobile Webkit, I think using CSS3's media query to adapt various devices would be a good choice. Here are some blog posts that are related:
Upvotes: 1