Module: RackPipeline::Compressing

Defined in:
lib/rack-pipeline/compressing.rb,
lib/rack-pipeline/compressing/uglifier.rb

Defined Under Namespace

Modules: Uglifier

Class Method Summary collapse

Class Method Details

.compressorsObject



21
22
23
# File 'lib/rack-pipeline/compressing.rb', line 21

def self.compressors
  @compressors ||= {}
end

.process(source, target) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/rack-pipeline/compressing.rb', line 5

def self.process(source, target)
  ext = File.extname source
  if compressor = compressors[ext]
    require compressor[1]
    Compressing.const_get(compressor[0]).process(source, target)
  else
    warn "no compressor found for #{source}"
    FileUtils.cp source, target
    target
  end
end

.register(ext, klass, feature) ⇒ Object



17
18
19
# File 'lib/rack-pipeline/compressing.rb', line 17

def self.register(ext, klass, feature)
  compressors[ext] = [klass, feature]
end