Sha256: 55cac040670d89fe5591c9be2b91a0a3a8a4ffde7c9974f4370276d9ec602551

Contents?: true

Size: 1.37 KB

Versions: 27

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

# 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[: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

  # 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

27 entries across 27 versions & 2 rubygems

Version Path
autoprefixer-rails-10.4.19.0 lib/autoprefixer-rails.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/autoprefixer-rails-10.4.16.0/lib/autoprefixer-rails.rb
autoprefixer-rails-10.4.16.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.4.13.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.4.7.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.4.2.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.4.0.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.3.3.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.3.1.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.2.5.1 lib/autoprefixer-rails.rb
autoprefixer-rails-10.2.5.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.2.4.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.2.0.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.1.0.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.0.3.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.0.2.0 lib/autoprefixer-rails.rb
autoprefixer-rails-10.0.1.3 lib/autoprefixer-rails.rb
autoprefixer-rails-10.0.1.2 lib/autoprefixer-rails.rb
autoprefixer-rails-10.0.1.1 lib/autoprefixer-rails.rb
autoprefixer-rails-10.0.1.0 lib/autoprefixer-rails.rb