Class: RapperLite::Compressors::Compressor

Inherits:
Object
  • Object
show all
Defined in:
lib/rapper_lite/compressors.rb

Overview

Base class for a compression handler.

Direct Known Subclasses

CSSCompressor, JSCompressor

Class Method Summary collapse

Class Method Details

.compress(file_path, opts = {}) ⇒ Object

Compress a file. Raises an error if it doesn’t know how to compress a file with the given file’s file extension.



27
28
29
30
31
32
33
# File 'lib/rapper_lite/compressors.rb', line 27

def compress( file_path, opts={} )
  unless compressor = @extensions[File.extname( file_path )]
    raise "RapperLite doesn't know how to compress #{file_path}"
  end
  
  compressor.do_compress( file_path, opts )
end