# module Sprockets::Compressors

### Public Class Methods

register_css_compressor(name, klass, options = {}) click to toggle source

    # File lib/sprockets/compressors.rb, line 8
    def self.register_css_compressor(name, klass, options = {})
      @@default_css_compressor = name.to_sym if options[:default] || @@default_css_compressor.nil?
      @@css_compressors[name.to_sym] = {:klass => klass.to_s, :require => options[:require]}
    end

register_js_compressor(name, klass, options = {}) click to toggle source

    # File lib/sprockets/compressors.rb, line 13
    def self.register_js_compressor(name, klass, options = {})
      @@default_js_compressor = name.to_sym if options[:default] || @@default_js_compressor.nil?
      @@js_compressors[name.to_sym] = {:klass => klass.to_s, :require => options[:require]}
    end

registered_css_compressor(name) click to toggle source

    # File lib/sprockets/compressors.rb, line 18
    def self.registered_css_compressor(name)
      if name.respond_to?(:to_sym)
        compressor = @@css_compressors[name.to_sym] || @@css_compressors[@@default_css_compressor]
        require compressor[:require] if compressor[:require]
        compressor[:klass].constantize.new
      else
        name
      end
    end

registered_js_compressor(name) click to toggle source

    # File lib/sprockets/compressors.rb, line 28
    def self.registered_js_compressor(name)
      if name.respond_to?(:to_sym)
        compressor = @@js_compressors[name.to_sym] || @@js_compressors[@@default_js_compressor]
        require compressor[:require] if compressor[:require]
        compressor[:klass].constantize.new
      else
        name
      end
    end