Sha256: 7d8c6b11fcffe46f40f064126891aafa9ab70a2a00d4f217f4036947c33b690e
Contents?: true
Size: 1.58 KB
Versions: 5
Compression:
Stored size: 1.58 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, :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 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 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 def asset_precompile_files @asset_precompile_files ||= [/\w+\.(?!js|css).+/, /application.(css|js)$/] end def asset_precompile_folder @asset_precompile_folder ||= "./public/#{ClassyAssets.config.asset_prefix}" end private def build_asset_paths Dir.glob(File.join(asset_root, asset_prefix, '*')) end end end
Version data entries
5 entries across 5 versions & 1 rubygems