# encoding: utf-8 require 'sprockets' module ClassyAssets class Sprockets attr_accessor :asset_root def initialize @asset_root = ClassyAssets.config.asset_root end def environment 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 @environment.context_class.class_eval do def asset_path(path, options = {}) ClassyAssets.asset_url_for(path) end end @environment end end end