Sha256: f5fdde520bb8892b99ada81e0d38b503001f929e7f11aca83d5c966c4a6d3edc
Contents?: true
Size: 1.87 KB
Versions: 13
Compression:
Stored size: 1.87 KB
Contents
# encoding: utf-8 require 'singleton' require 'classy_assets/errors/nil_asset_root' module ClassyAssets class Config include Singleton 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_debug @asset_debug = (ENV['RACK_ENV'] == 'development') unless defined? @asset_debug @asset_debug end 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_version @asset_version ||= ClassyAssets::VERSION end def css_compressor @css_compressor ||= :yui end def js_compressor @js_compressor ||= :uglifier end private def build_asset_paths Dir.glob(File.join(asset_root, asset_prefix, '*')) end end end
Version data entries
13 entries across 13 versions & 1 rubygems