Socket
Book a DemoInstallSign in
Socket

rack-body_classes

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rack-body_classes

1.0.2
bundlerRubygems
Version published
Maintainers
1
Created
Source

Rack::BodyClasses

Decorate your <body> with CSS Classes indicating platform, browser, browser version, and more.

Project Status

  • Build: Build Status
  • Dependencies: Dependency Status
  • Code Quality: Code Climate

Installation

Add this line to your application's Gemfile:

gem 'rack-body_classes'

And then execute:

$ bundle

Usage

First, add the middlware to your application...

Rack/Sinatra

use Rack::BodyClasses

Rails

config.middleware.use Rack::BodyClasses

Then, in your layout, output env['rack.body_classes'] in your <body> tag's class attribute.

Here's a trivial layout file, formatted with the slim templating engine, to give you an example:

html
  head
  body class="#{env['rack.body_classes']}"
    == yield

When rendered, the body tag will look something like this:

<body class="desktop chrome modern mac webkit">

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

Shout Outs

This middleware is made possible by Browser gem and MobileESP (converted) gem and borrows a bit of code from Mobvious gem. Mad props and many thank yous to these gem authors.

FAQs

Package last updated on 31 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.