Sha256: a2834281d93261a112fcf988463701ae459e0b98c51fd40313f1ac5448ba01c5

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

# Ruby integration with Autoprefixer JS library, which parse CSS and adds
# only actual prefixed
module AutoprefixerRails
  autoload :Sprockets, 'autoprefixer-rails/sprockets'

  # Add prefixes to `css`. See `Processor#process` for options.
  def self.process(css, opts = {})
    params = {}
    params[:browsers] = opts.delete(:browsers) if opts.has_key?(:browsers)
    params[:cascade]  = opts.delete(:cascade)  if opts.has_key?(:cascade)
    params[:remove]   = opts.delete(:remove)   if opts.has_key?(:remove)
    processor(params).process(css, opts)
  end

  # Add Autoprefixer for Sprockets environment in `assets`.
  # You can specify `browsers` actual in your project.
  def self.install(assets, params = {}, opts = {})
    Sprockets.new( processor(params) ).install(assets, opts)
  end

  # Cache processor instances
  def self.processor(params = {})
    @cache  ||= {}
    @cache[params.hash.to_s] ||= Processor.new(params)
  end
end

require_relative 'autoprefixer-rails/result'
require_relative 'autoprefixer-rails/version'
require_relative 'autoprefixer-rails/processor'

require_relative 'autoprefixer-rails/railtie' if defined?(Rails)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
autoprefixer-rails-5.0.0.2 lib/autoprefixer-rails.rb
autoprefixer-rails-5.0.0.1 lib/autoprefixer-rails.rb
autoprefixer-rails-5.0.0 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.2.2 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.2.1 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.2 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.1.1 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.1 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.0.1 lib/autoprefixer-rails.rb
autoprefixer-rails-4.0.0 lib/autoprefixer-rails.rb