lib/classy_assets.rb in classy_assets-0.0.2 vs lib/classy_assets.rb in classy_assets-0.0.4
- old
+ new
@@ -1,90 +1,180 @@
-require "classy_assets/version"
+# encoding: utf-8
+
+require 'classy_assets/version'
+module ClassyAssets
+ class Configuration
+ def self.configure
+ yield self
+ end
+
+ def self.asset_digest
+ @asset_digest ||= false
+ end
+
+ def self.asset_digest=(digest)
+ @asset_digest = digest
+ end
+
+ def self.asset_dirs
+ @asset_dirs ||= %w(fonts images javascripts stylesheets)
+ end
+
+ def self.asset_dirs=(dirs)
+ @asset_dirs = dirs
+ end
+
+ def self.asset_host
+ @asset_host ||= nil
+ end
+
+ def self.asset_host=(host)
+ @asset_host = host
+ end
+
+ def self.asset_prefix
+ @asset_prefix ||= 'assets'
+ end
+
+ def self.asset_prefix=(prefix)
+ @asset_prefix = prefix
+ end
+
+ def self.css_compressor
+ @css_compressor ||= :yui
+ end
+
+ def self.css_compressor=(compressor)
+ @css_compressor = compressor
+ end
+
+ def self.debug_mode
+ @debug_mode ||= (ENV['RACK_ENV'] == 'development')
+ end
+
+ def self.debug_mode=(debug)
+ @debug_mode = debug
+ end
+
+ def self.js_compressor
+ @js_compressor ||= :uglifier
+ end
+
+ def self.js_compressor=(compressor)
+ @js_compressor = compressor
+ end
+
+ def self.public_path
+ @public_path ||= './public'
+ end
+
+ def self.public_path=(path)
+ @public_path = path
+ end
+
+ def self.root_path
+ @root_path ||= '.'
+ end
+
+ def self.root_path=(path)
+ @root_path = path
+ end
+
+ def self.sprockets
+ @sprockets ||= Sprockets::Environment.new(root_path)
+ asset_dirs.each do |asset_dir|
+ _path = File.join(root_path, asset_prefix, asset_dir)
+ @sprockets.append_path _path
+ end
+ @sprockets
+ end
+ end
+end