Project

css_media

0.0
No commit activity in last 3 years
No release in over 3 years
Filter CSS to produce only @media rules
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
>= 0
 Project Readme

CssMedia

Gem Version Build Status

A small rails extension to segregate @media CSS rules.

This can be helpful when sending emails, as non media rules should be inlined (with premailer-rails or roadie) but media rules should be included with a <style> tag.

Installation

Add this line to your application's Gemfile:

gem 'css_media'

And then execute:

$ bundle

Usage

Using Filename

If your filename contains media-only, then only the @media css rules will be kept. If the filename matches non-media or no-media, then all rules will be kept except the @media rules. Other assets will be kept intact

Using Comment

If your CSS contains a comment of the form /* css_media: media-only */, then only the @media css rules will be kept. A value of non-media or no-media will instead keep all rules except the @media ones.

Development

Much of the boilerplate code copied from autoprefixer-rails, thanks!

To run the tests: rspec. You'll need to initial run bundle of course.

License

The gem is available as open source under the terms of the MIT License.