Sha256: fed5998cea9a6a976d7f1c875f447046b4142466fa0249816401b876ec42abac

Contents?: true

Size: 789 Bytes

Versions: 16

Compression:

Stored size: 789 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)
      input  = context.pathname.to_s
      output = input.chomp(File.extname(input)) + '.css'
      result = @processor.process(css, from: input, to: output)

      result.warnings.each do |warning|
        $stderr.puts "autoprefixer: #{ warning }"
      end

      result.css
    end

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

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
autoprefixer-rails-6.3.3 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.3.2 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.3.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.3.0 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.2.3 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.2.2 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.2.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.2.0 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.1.2 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.1.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.1.0.1 lib/autoprefixer-rails/sprockets.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/autoprefixer-rails-6.0.3/lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.0.3 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.0.2 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.0.1 lib/autoprefixer-rails/sprockets.rb
autoprefixer-rails-6.0.0 lib/autoprefixer-rails/sprockets.rb