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

:nodoc:

Defined Under Namespace

Classes: Processor, Result, Sprockets

Constant Summary collapse

VERSION =
"10.4.19.0"
IS_SECTION =
/^\s*\[(.+)\]\s*$/.freeze

Class Method Summary collapse

Class Method Details

.install(assets, params = {}) ⇒ Object

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



21
22
23
24
# File 'lib/autoprefixer-rails.rb', line 21

def self.install(assets, params = {})
  Sprockets.register_processor(processor(params))
  Sprockets.install(assets)
end

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

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



9
10
11
12
13
14
15
16
17
# File 'lib/autoprefixer-rails.rb', line 9

def self.process(css, opts = {})
  params = {}
  params[:overrideBrowserslist] = opts.delete(:overrideBrowserslist) if opts.key?(:overrideBrowserslist)
  params[:browsers] = opts.delete(:browsers) if opts.key?(:browsers)
  params[:cascade]  = opts.delete(:cascade)  if opts.key?(:cascade)
  params[:remove]   = opts.delete(:remove)   if opts.key?(:remove)
  params[:env]      = opts.delete(:env)      if opts.key?(:env)
  processor(params).process(css, opts)
end

.processor(params = {}) ⇒ Object

Cache processor instances



32
33
34
# File 'lib/autoprefixer-rails.rb', line 32

def self.processor(params = {})
  Processor.new(params)
end

.uninstall(assets) ⇒ Object

Disable installed Autoprefixer



27
28
29
# File 'lib/autoprefixer-rails.rb', line 27

def self.uninstall(assets)
  Sprockets.uninstall(assets)
end