Class: Sprockets::ClosureCompressor

### Home Classes Methods

### In Files

- lib/sprockets/closure_compressor.rb

### Parent

Object

### Methods

- ::cache_key
- ::call
- ::instance
- ::new
- #call

### Class/Module Index

Quicksearch

- Sprockets
- Sprockets::ArgumentError
- Sprockets::Asset
- Sprockets::Autoload
- Sprockets::Base
- Sprockets::Bower
- Sprockets::Bundle
- Sprockets::Cache
- Sprockets::Cache::FileStore
- Sprockets::Cache::GetWrapper
- Sprockets::Cache::HashWrapper
- Sprockets::Cache::MemoryStore
- Sprockets::Cache::NullStore
- Sprockets::Cache::ReadWriteWrapper
- Sprockets::Cache::Wrapper
- Sprockets::CachedEnvironment
- Sprockets::ClosureCompressor
- Sprockets::CoffeeScriptProcessor
- Sprockets::CoffeeScriptTemplate
- Sprockets::Compressing
- Sprockets::Configuration
- Sprockets::ContentTypeMismatch
- Sprockets::Context
- Sprockets::ConversionError
- Sprockets::Dependencies
- Sprockets::DigestUtils
- Sprockets::DirectiveProcessor
- Sprockets::ERBProcessor
- Sprockets::ERBTemplate
- Sprockets::EcoProcessor
- Sprockets::EcoTemplate
- Sprockets::EjsProcessor
- Sprockets::EjsTemplate
- Sprockets::EncodingUtils
- Sprockets::Engines
- Sprockets::Environment
- Sprockets::Error
- Sprockets::FileNotFound
- Sprockets::FileOutsidePaths
- Sprockets::FileReader
- Sprockets::HTTPUtils
- Sprockets::Index
- Sprockets::JstProcessor
- Sprockets::LegacyProcProcessor
- Sprockets::LegacyTiltProcessor
- Sprockets::Loader
- Sprockets::Manifest
- Sprockets::ManifestUtils
- Sprockets::Mime
- Sprockets::NotFound
- Sprockets::NotImplementedError
- Sprockets::PathDependencyUtils
- Sprockets::PathDigestUtils
- Sprockets::PathUtils
- Sprockets::Paths
- Sprockets::Processing
- Sprockets::ProcessorUtils
- Sprockets::Resolve
- Sprockets::SassCompressor
- Sprockets::SassProcessor
- Sprockets::SassProcessor::CacheStore
- Sprockets::SassProcessor::Functions
- Sprockets::SassTemplate
- Sprockets::ScssProcessor
- Sprockets::ScssTemplate
- Sprockets::Server
- Sprockets::Transformers
- Sprockets::URITar
- Sprockets::URIUtils
- Sprockets::UglifierCompressor
- Sprockets::UnloadedAsset
- Sprockets::Utils
- Sprockets::YUICompressor
- Rake
- Rake::SprocketsTask

No matching classes.

# Sprockets::ClosureCompressor

Public: Closure Compiler minifier.

To accept the default options

    environment.register_bundle_processor 'application/javascript',
      Sprockets::ClosureCompressor

Or to pass options to the Closure::Compiler class.

    environment.register_bundle_processor 'application/javascript',
      Sprockets::ClosureCompressor.new({ ... })

### Constants

VERSION

### Attributes

cache_key[R]

### Public Class Methods

cache_key() click to toggle source

    # File lib/sprockets/closure_compressor.rb, line 31
    def self.cache_key
      instance.cache_key
    end

call(input) click to toggle source

    # File lib/sprockets/closure_compressor.rb, line 27
    def self.call(input)
      instance.call(input)
    end

instance() click to toggle source

Public: Return singleton instance with default options.

Returns ClosureCompressor object.

    # File lib/sprockets/closure_compressor.rb, line 23
    def self.instance
      @instance ||= new
    end

new(options = {}) click to toggle source

    # File lib/sprockets/closure_compressor.rb, line 37
    def initialize(options = {})
      @compiler = Autoload::Closure::Compiler.new(options)
      @cache_key = "#{self.class.name}:#{Autoload::Closure::VERSION}:#{Autoload::Closure::COMPILER_VERSION}:#{VERSION}:#{DigestUtils.digest(options)}".freeze
    end

### Public Instance Methods

call(input) click to toggle source

    # File lib/sprockets/closure_compressor.rb, line 42
    def call(input)
      @compiler.compile(input[:data])
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.