lib/classy_assets/config.rb in classy_assets-0.8.2 vs lib/classy_assets/config.rb in classy_assets-0.9.0
- old
+ new
@@ -1,17 +1,23 @@
# encoding: utf-8
require 'singleton'
+require 'classy_assets/errors/nil_asset_root'
module ClassyAssets
class Config
include Singleton
- attr_accessor :asset_compress, :css_compressor, :js_compressor
+ 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
@@ -45,10 +51,10 @@
raise Errors::NilAssetRoot.new if @asset_root.nil?
@asset_root
end
def asset_precompile_files
- @asset_precompile_files ||= %w(application.css application.js)
+ @asset_precompile_files ||= [/\w+\.(?!js|css).+/, /application.(css|js)$/]
end
def asset_precompile_folder
@asset_precompile_folder ||= "./public/#{ClassyAssets.config.asset_prefix}"
end