Sha256: 2f3efc8669ac1c59b5e3249afe6fd93ea07a64322db5828b950ff8c54c4b34ff

Contents?: true

Size: 1.2 KB

Versions: 46

Compression:

Stored size: 1.2 KB

Contents

require "yaml"

begin
  module AutoprefixedRails
    class Railtie < ::Rails::Railtie
      rake_tasks do |app|
        require "rake/autoprefixer_tasks"
        Rake::AutoprefixerTasks.new(config) if defined? app.assets
      end

      if config.respond_to?(:assets) && !config.assets.nil?
        config.assets.configure do |env|
          AutoprefixerRails.install(env, config)
        end
      else
        initializer :setup_autoprefixer, group: :all do |app|
          if defined?(app.assets) && !app.assets.nil?
            AutoprefixerRails.install(app.assets, config)
          end
        end
      end

      # Read browsers requirements from application or engine config
      def config
        params = {}

        roots.each do |root|
          file = File.join(root, "config/autoprefixer.yml")

          if File.exist?(file)
            parsed = ::YAML.load_file(file)
            next unless parsed
            params = parsed

            break
          end
        end

        params = params.symbolize_keys
        params[:env] ||= Rails.env.to_s
        params
      end

      def roots
        [Rails.application.root] + Rails::Engine.subclasses.map(&:root)
      end
    end
  end
rescue LoadError
end

Version data entries

46 entries across 31 versions & 2 rubygems

Version Path
autoprefixer-rails-9.8.6 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.8.5 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.8.4 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.8.3 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.8.2 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.8.1 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.7.6 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.7.5 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.7.4 lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.5/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.7.1/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.4/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.7.3/lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.7.3 lib/autoprefixer-rails/railtie.rb
autoprefixer-rails-9.7.2 lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1.1/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.1/lib/autoprefixer-rails/railtie.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/autoprefixer-rails-9.6.4/lib/autoprefixer-rails/railtie.rb