Sha256: 92ea8bfb513b6a77046b73a1a16ee2502ebc04195002931e19b2e06ef2eabcc2

Contents?: true

Size: 701 Bytes

Versions: 24

Compression:

Stored size: 701 Bytes

Contents

require 'pathname'

module AutoprefixerRails
  # Register autoprefixer postprocessor in Sprockets and fix common issues
  class Sprockets
    def initialize(processor)
      @processor = processor
    end

    # Add prefixes for `css`
    def process(context, css, opts)
      input  = context.pathname.to_s
      output = input.chomp(File.extname(input)) + '.css'

      @processor.process(css, opts.merge(from: input, to: output)).css
    end

    # Register postprocessor in Sprockets depend on issues with other gems
    def install(assets, opts = {})
      assets.register_postprocessor('text/css', :autoprefixer) do |context, css|
        process(context, css, opts)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
autoprefixer-rails-5.1.11 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.10 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.9 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.8.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.8 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.7.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.7 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.6 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.5 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.4 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.3.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.3 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.2 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.1.0 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.0.0.3 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.0.0.2 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.0.0.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-5.0.0 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-4.0.2.2 lib/autoprefixer-rails/sprockets.rb