0.0
No commit activity in last 3 years
No release in over 3 years
There's a lot of open issues
CSS Media Requeries are a nice idea but don't cut down payload size. Serve only what is needed for each device. This gem lets you access device information in a Rails controller/view. Now be really responsive!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Crispy Mobile

What does it do?

Crispy Mobile empowers your Rails application with easy-accessible device-detection. In your controller or view, you can access device properties or add switches like:

- if device == :desktop
  = stylesheet_link_tag :desktop
- else
  = stylesheet_link_tag :mobile

= image_tag @photo.dynamic_url(device > :handheld_480 ? '600x400' : '300x200')

= image_tag @photo.dynamic_url("#{device.display_width}x")

Why should my app be responsive on the server side?

CSS media queries are nice. But not for mobile.

They just add up code you send to your clients instead of reducing it for mobile devices.

Imagine you want to make a responsive product page.

  • Do you really want to deliver a big 90KB product photo, if a 15KB photo would already fill the mobile screen?
  • Do you really want to compute personalized product recommendations if they are just hidden afterwards?
  • Do you really want mobile devices to download and interpret your whole stylesheet if half of the interface elements are going to be hidden anyway?

You don't.

If you start mobile-first, don't let your mobile performance be affected by additional desktop features.

Be kind, serve the clients exactly what they need.

How is it done?

A middleware is introduced which looks up the user agent string in the WURFL repository.

Usage

Pending. Please have a look at the source.

Installation

In your Gemfile add:

  gem 'crispy-mobile'

In your ApplicationController add:

  include Crispy::DeviceHelpers

License

See MIT-LICENSE.