lib/classy_assets/sprockets.rb in classy_assets-0.8.2 vs lib/classy_assets/sprockets.rb in classy_assets-0.9.0
- old
+ new
@@ -1,24 +1,21 @@
# encoding: utf-8
-require 'singleton'
-require 'sprockets'
+require 'sprockets'
module ClassyAssets
class Sprockets
- include Singleton
+ attr_accessor :asset_root
+ def initialize
+ @asset_root = ClassyAssets.config.asset_root
+ end
def environment
- asset_root = ClassyAssets.config.asset_root
+ return @environment if @environment.instance_of? ::Sprockets::Environment
@environment = ::Sprockets::Environment.new(asset_root)
-
+
ClassyAssets.config.asset_paths.each do |asset_path|
@environment.append_path asset_path
- end
-
- if ClassyAssets.config.asset_compress
- @environment.css_compressor = ClassyAssets.config.css_compressor
- @environment.js_compressor = ClassyAssets.config.css_compressor
end
@environment.context_class.class_eval do
def asset_path(path, options = {})
ClassyAssets.asset_url_for(path)