lib/jammit/dependencies.rb in jammit-0.6.0 vs lib/jammit/dependencies.rb in jammit-0.6.1
- old
+ new
@@ -5,17 +5,31 @@
require 'yaml'
require 'base64'
require 'pathname'
require 'fileutils'
-# Gem Dependencies:
+# Include YUI as the default
require 'yui/compressor'
-require 'closure-compiler'
+# Try Closure.
+begin
+ require 'closure-compiler'
+rescue LoadError
+ Jammit.compressors.delete :closure
+end
+
+# Try Uglifier.
+begin
+ require 'uglifier'
+rescue LoadError
+ Jammit.compressors.delete :uglifier
+end
+
# Load initial configuration before the rest of Jammit.
Jammit.load_configuration(Jammit::DEFAULT_CONFIG_PATH, true) if defined?(Rails)
# Jammit Core:
+require 'jammit/uglifier' if Jammit.compressors.include? :uglifier
require 'jammit/compressor'
require 'jammit/packager'
# Jammit Rails Integration:
if defined?(Rails)