# encoding: utf-8 require 'singleton' module ClassyAssets class Config include Singleton attr_accessor :asset_debug, :asset_digest, :asset_host, :asset_paths, :asset_prefix, :asset_root attr_accessor :asset_compress, :css_compressor, :js_compressor def asset_compress @asset_compress if defined? @asset_compress end def css_compressor @css_compressor ||= :yui end def js_compressor @js_compressor ||= :uglifier end def asset_debug @asset_debug = (ENV['RACK_ENV'] == 'development') unless defined? @asset_debug @asset_debug end def asset_digest @asset_digest if defined? @asset_digest end def asset_paths @asset_paths = build_asset_paths unless defined? @asset_paths @asset_paths.uniq! @asset_paths end def asset_prefix @asset_prefix ||= 'assets' end def asset_root raise Errors::NilAssetRoot.new if @asset_root.nil? @asset_root end private def build_asset_paths Dir.glob(File.join(asset_root, asset_prefix, '*')) end end end