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

- old
+ new

@@ -4,33 +4,36 @@ require 'sprockets' module ClassyAssets class Sprockets attr_accessor :asset_root, :environment def initialize - @asset_root = ClassyAssets.config.asset_root + @config = ClassyAssets.config + @asset_root = @config.asset_root @environment = new_sprockets_environment end private def new_sprockets_environment - @environment = ::Sprockets::Environment.new(asset_root) { @version = ClassyAssets::VERSION } + sprockets_environment = ::Sprockets::Environment.new(asset_root) do + @version = @config.asset_version + end - ClassyAssets.config.asset_paths.each do |asset_path| - @environment.append_path asset_path + @config.asset_paths.each do |asset_path| + sprockets_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 + if @config.asset_compress + sprockets_environment.css_compressor = @config.css_compressor + sprockets_environment.js_compressor = @config.css_compressor end - @environment.context_class.class_eval do + sprockets_environment.context_class.class_eval do def asset_path(path, options = {}) ClassyAssets.asset_url_for(path) end end - @environment + sprockets_environment end end end