Sha256: e9328cea26178aa277fa71a9090dd5f7e5eaa5a5f3dcc53e0c891d6b1889ab7d

Contents?: true

Size: 762 Bytes

Versions: 6

Compression:

Stored size: 762 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

      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)
        end
      end

      @environment
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
classy_assets-0.8.2 lib/classy_assets/sprockets.rb
classy_assets-0.8.1 lib/classy_assets/sprockets.rb
classy_assets-0.8.0 lib/classy_assets/sprockets.rb
classy_assets-0.7.2 lib/classy_assets/sprockets.rb
classy_assets-0.7.1 lib/classy_assets/sprockets.rb
classy_assets-0.7.0 lib/classy_assets/sprockets.rb