lib/massimo/javascript.rb in massimo-0.7.3 vs lib/massimo/javascript.rb in massimo-0.7.4

- old
+ new

@@ -8,37 +8,37 @@ @extension ||= '.js' end protected - def compile - case source_path.extname - when '.coffee' - require 'coffee-script' unless defined?(CoffeeScript) - CoffeeScript.compile(content, Massimo.config.options_for(:coffee_script)) - else - require 'sprockets' unless defined?(Sprockets) - options = Massimo.config.options_for(:sprockets).merge( - :assert_root => Massimo.config.output_path, - :source_files => [ source_path.to_s ] - ) - secretary = Sprockets::Secretary.new(options) - secretary.install_assets - secretary.concatenation.to_s + def compile + case source_path.extname + when '.coffee' + require 'coffee-script' unless defined?(CoffeeScript) + CoffeeScript.compile(content, Massimo.config.options_for(:coffee_script)) + else + require 'sprockets' unless defined?(Sprockets) + options = Massimo.config.options_for(:sprockets).merge( + :assert_root => Massimo.config.output_path, + :source_files => [ source_path.to_s ] + ) + secretary = Sprockets::Secretary.new(options) + secretary.install_assets + secretary.concatenation.to_s + end end - end - def compress(javascript) - case Massimo.config.javascripts_compressor.to_s - when 'min', 'jsmin' - require 'jsmin' unless defined?(JSMin) - JSMin.minify(javascript).strip - when 'pack', 'packr' - require 'packr' unless defined?(Packr) - options = { :shrink_vars => true }.merge Massimo.config.options_for(:packr) - Packr.pack(javascript, options) - else - javascript + def compress(javascript) + case Massimo.config.javascripts_compressor.to_s + when 'min', 'jsmin' + require 'jsmin' unless defined?(JSMin) + JSMin.minify(javascript).strip + when 'pack', 'packr' + require 'packr' unless defined?(Packr) + options = { :shrink_vars => true }.merge Massimo.config.options_for(:packr) + Packr.pack(javascript, options) + else + javascript + end end - end end end \ No newline at end of file