Sha256: cc4959cb1a2b45665a5ae17c29f9edd740045281ccab1c1959fec7684a6d12ce

Contents?: true

Size: 663 Bytes

Versions: 2

Compression:

Stored size: 663 Bytes

Contents

# 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
classy_assets-0.9.1 lib/classy_assets/sprockets.rb
classy_assets-0.9.0 lib/classy_assets/sprockets.rb