lib/classy_assets/config.rb in classy_assets-0.9.4 vs lib/classy_assets/config.rb in classy_assets-0.10.0

- old
+ new

@@ -5,60 +5,70 @@ module ClassyAssets class Config include Singleton - attr_accessor :asset_cache, :asset_compress, :css_compressor, :js_compressor - attr_accessor :asset_debug, :asset_digest, :asset_host, :asset_paths, :asset_prefix, :asset_root - attr_accessor :asset_precompile_folder, :asset_precompile_files + attr_accessor :asset_cache, :asset_compress, :asset_debug, :asset_digest, + :asset_host, :asset_manifest_path, :asset_paths, + :asset_precompile, :asset_precompile_keep, + :asset_precompile_path, :asset_prefix, :asset_public_path, + :asset_root, :asset_version, :css_compressor, :js_compressor def asset_cache @asset_cache = (ENV['RACK_ENV'] == 'production') unless defined? @asset_cache @asset_cache end - 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 + def asset_manifest_path + @asset_manifest_path ||= File.join(asset_precompile_path, 'manifest.json') end def asset_paths @asset_paths = build_asset_paths unless defined? @asset_paths @asset_paths.uniq! @asset_paths end + def asset_precompile + @asset_precompile ||= [/\w+\.(?!js|css).+/, /application.(css|js)$/] + end + + def asset_precompile_keep + @asset_precompile_keep ||= 2 + end + + def asset_precompile_path + @asset_precompile_path ||= File.join(asset_public_path, asset_prefix) + end + def asset_prefix @asset_prefix ||= 'assets' end + def asset_public_path + @asset_public_path ||= File.join(asset_root, 'public') + end + def asset_root raise Errors::NilAssetRoot.new if @asset_root.nil? @asset_root end - def asset_precompile_files - @asset_precompile_files ||= [/\w+\.(?!js|css).+/, /application.(css|js)$/] + def asset_version + @asset_version ||= ClassyAssets::VERSION end - def asset_precompile_folder - @asset_precompile_folder ||= "./public/#{ClassyAssets.config.asset_prefix}" + def css_compressor + @css_compressor ||= :yui + end + + def js_compressor + @js_compressor ||= :uglifier end private def build_asset_paths