Module: Shine::JS

Defined in:
lib/shine.rb

Defined Under Namespace

Classes: Compressor

Class Method Summary collapse

Class Method Details

.file(f, options = {}) ⇒ Object



116
117
118
# File 'lib/shine.rb', line 116

def self.file(f, options={})
  self.files(f, options)
end

.files(input_files, options = {}) ⇒ Object



120
121
122
123
124
125
# File 'lib/shine.rb', line 120

def self.files(input_files, options={})
  input_files = [input_files] unless input_files.is_a?(Array)
  input_files.flatten!
  compressor = Shine::JS::Compressor.new(input_files)
  compressor.compress(options)
end

.in_place(input_file_path) ⇒ Object



103
104
105
106
# File 'lib/shine.rb', line 103

def self.in_place(input_file_path)
  compressor = Shine::JS::Compressor.new(input_file_path)
  compressor.compress_in_place
end

.string(js, options = {}) ⇒ Object



108
109
110
111
112
113
114
# File 'lib/shine.rb', line 108

def self.string(js, options={})
  begin
    Shine.compress_string(js, :js, options)
  rescue CompressionError
    js
  end
end