GithubHelp home page GithubHelp logo

tisho / autoprefixer-rails Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ai/autoprefixer-rails

0.0 2.0 0.0 303 KB

Autoprefixer for Ruby and Ruby on Rails

Home Page: https://twitter.com/autoprefixer

License: GNU Lesser General Public License v3.0

Ruby 99.78% CSS 0.22%

autoprefixer-rails's Introduction

Autoprefixer Rails

Autoprefixer is a tool to parse CSS and add vendor prefixes to CSS rules using values from the Can I Use. This gem provides Ruby and Ruby on Rails integration with this JavaScript tool.

Sponsored by Evil Martians.

Usage

Ruby on Rails

Add the autoprefixer-rails gem to your Gemfile:

gem "autoprefixer-rails"

Write your CSS (Sass, Stylus, LESS) rules without vendor prefixes and Autoprefixer will apply prefixes for you. For example in app/assets/stylesheet/foobar.sass:

:fullscreen a
  transition: transform 1s

Autoprefixer uses Can I Use database with browser statistics and properties support to add vendor prefixes automatically using the Asset Pipeline:

:-webkit-full-screen a {
  -webkit-transition: -webkit-transform 1s;
  transition: transform 1s;
}

:-moz-full-screen a {
  transition: transform 1s;
}

:fullscreen a {
  -webkit-transition: -webkit-transform 1s;
  transition: transform 1s;
}

If you need to specify browsers for your project, you can save them to config/autoprefixer.yml. See browser section in Autoprefixer docs.

browsers:
  - "last 1 version"
  - "> 1%"
  - "ie 8"

You can inspect what properties will be changed using a Rake task:

rake autoprefixer:inspect

By default, Autoprefixer uses > 1%, last 2 versions, ff 17, opera 12.1:

  • Firefox 17 is a latest ESR.
  • Opera 12.1 will be in list until Opera supports non-Blink 12.x branch.

Sprockets

If you use Sinatra or other non-Rails frameworks with Sprockets, just connect your Sprockets environment with Autoprefixer and write CSS in the usual way:

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

require "autoprefixer-rails"
AutoprefixerRails.install(assets)

Ruby

If you need to call Autoprefixer from plain Ruby code, it’s very easy:

require "autoprefixer-rails"
prefixed = AutoprefixerRails.compile(css)

autoprefixer-rails's People

Contributors

ai avatar iainbeeston avatar porada avatar tisho avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.