0.0
No commit activity in last 3 years
No release in over 3 years
Generate pixel fallbacks for rem units in Rails application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
>= 0

Runtime

>= 0
 Project Readme

Rails-pixrem

Build Status

CSS post-processor which generates pixel fallbacks for rem units in your Rails (Sinatra) application.

Usage

Ruby on Rails

Add rails-pixrem to your Gemfile:

gem 'rails-pixrem', github: 'vast/rails-pixrem'

Write your CSS (SASS, Stylus, LESS) using rems:

#header {
  font-size: 2rem;
}

Rails-pixrem will automatically add fallback rules with pixel values:

#header {
  font-size: 32px; // IE8, Opera Mini
  font-size: 2rem; // modern browsers
}

Sprockets

If you use a non-Rails framework with Sprockets, connect Sprockets environment with RailsPixrem:

assets = Sprockets::Environment.new do |env|
  # ...
end

require 'rails-pixrem'
RailsPixrem.install(assets)

Configuration

You can specify root element font size (default: '16px') in px, em or percents:

Ruby On Rails

# config/pixrem.yml
root_value: 24px

Sprockets

RailsPixrem.install(assets, root_value: '85%')