Module: AutoprefixerRails

Defined in:
lib/autoprefixer-rails.rb,
lib/autoprefixer-rails/result.rb,
lib/autoprefixer-rails/version.rb,
lib/autoprefixer-rails/processor.rb,
lib/autoprefixer-rails/sprockets.rb

Overview

Ruby integration with Autoprefixer JS library, which parse CSS and adds only actual prefixed

Defined Under Namespace

Classes: Processor, Result, Sprockets

Constant Summary collapse

VERSION =
'1.0.20140130'.freeze

Class Method Summary collapse

Class Method Details

.compile(css, browsers = nil) ⇒ Object

Deprecated method. Use ‘process` instead.



25
26
27
# File 'lib/autoprefixer-rails.rb', line 25

def self.compile(css, browsers = nil)
  processor(browsers).compile(css)
end

.install(assets, browsers = nil) ⇒ Object

Add Autoprefixer for Sprockets environment in ‘assets`. You can specify `browsers` actual in your project.



14
15
16
# File 'lib/autoprefixer-rails.rb', line 14

def self.install(assets, browsers = nil)
  Sprockets.new( processor(browsers) ).install(assets)
end

.process(css, opts = { }) ⇒ Object

Add prefixes to ‘css`. See `Processor#process` for options.



7
8
9
10
# File 'lib/autoprefixer-rails.rb', line 7

def self.process(css, opts = { })
  browsers = opts.delete(:browsers)
  processor(browsers).process(css, opts)
end

.processor(browsers = nil) ⇒ Object

Cache processor instances



19
20
21
22
# File 'lib/autoprefixer-rails.rb', line 19

def self.processor(browsers=nil)
  @cache ||= { }
  @cache[browsers] ||= Processor.new(browsers)
end