Sha256: 5814e0b62ee35579118f4187ef3737af479def8bc539758671fdca6b2589498e

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

# encoding: utf-8

require 'singleton'
require 'sprockets'

module ClassyAssets
  class Sprockets
    include Singleton

    def environment
      asset_root = ClassyAssets.config.asset_root
      @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

4 entries across 4 versions & 1 rubygems

Version Path
classy_assets-0.6.3 lib/classy_assets/sprockets.rb
classy_assets-0.6.2 lib/classy_assets/sprockets.rb
classy_assets-0.6.1 lib/classy_assets/sprockets.rb
classy_assets-0.6.0 lib/classy_assets/sprockets.rb