Sha256: 7703f4daae8a575d3bbd2d5f929977ea54f2d4cfb549b1549a5673730417eeb2

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 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.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

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

  # Disable installed Autoprefixer
  def self.uninstall(assets)
    Sprockets.uninstall(assets)
  end

  # Cache processor instances
  def self.processor(params = {})
    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

6 entries across 6 versions & 1 rubygems

Version Path
autoprefixer-rails-9.5.1.1 lib/autoprefixer-rails.rb
autoprefixer-rails-9.5.1 lib/autoprefixer-rails.rb
autoprefixer-rails-9.5.0 lib/autoprefixer-rails.rb
autoprefixer-rails-9.4.10.2 lib/autoprefixer-rails.rb
autoprefixer-rails-9.4.10.1 lib/autoprefixer-rails.rb
autoprefixer-rails-9.4.10 lib/autoprefixer-rails.rb