Module: JavascriptFeatures::Compiler

Defined in:
lib/javascript_features/compiler.rb

Class Method Summary collapse

Class Method Details

.compile(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/javascript_features/compiler.rb', line 5

def self.compile(options = {})
  defaults = {:minify => true, :package => 'main'}
  options = defaults.merge(options)

  files = files_for_package(options[:package])
  compiled = files.map{|file| File.read(file) }.join("\n")
  minified = JSMin.minify(compiled) if options[:minify]

  minified || compiled
end

.package_modified_time(package = 'main') ⇒ Object



16
17
18
# File 'lib/javascript_features/compiler.rb', line 16

def self.package_modified_time(package = 'main')
  files_for_package(package).map{|f| File.mtime(f) }.max
end