Class: Jammit::Compressor

Inherits:
Object
  • Object
show all
Defined in:
lib/fingerjam/jammit.rb,
lib/fingerjam/fix_jammit_encoding.rb

Instance Method Summary collapse

Instance Method Details

#compress_js(paths) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/fingerjam/fix_jammit_encoding.rb', line 6

def compress_js(paths)
  if (jst_paths = paths.grep(Jammit.template_extension_matcher)).empty?
    js = concatenate(paths)
  else
    js = concatenate(paths - jst_paths) + compile_jst(jst_paths)
  end
  js = js.force_encoding('utf-8')
  Jammit.compress_assets ? @js_compressor.compress(js) : js
end

#rewrite_asset_path(relative_path, absolute_path) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/fingerjam/jammit.rb', line 8

def rewrite_asset_path(relative_path, absolute_path)
  if File.exist?(absolute_path)
    Fingerjam::Base.save_cached_url_from_path(relative_path, absolute_path)
  else
    rewrite_asset_path_without_fingerjam(relative_path, absolute_path)
  end
end

#rewrite_asset_path_without_fingerjamObject



6
# File 'lib/fingerjam/jammit.rb', line 6

alias :rewrite_asset_path_without_fingerjam :rewrite_asset_path