Sha256: 46682f4466261cbf0e34757d1a1ec99c600d85d1b53445fba67c59d85b0bf64a

Contents?: true

Size: 956 Bytes

Versions: 12

Compression:

Stored size: 956 Bytes

Contents

# encoding: utf-8


require 'sprockets'
module ClassyAssets
  class Sprockets
    attr_accessor :asset_root, :environment
    def initialize
      @config = ClassyAssets.config
      @asset_root = @config.asset_root
      @environment = new_sprockets_environment
    end

    private

    def new_sprockets_environment
      sprockets_environment = ::Sprockets::Environment.new(asset_root) do
        @version = @config.asset_version
      end
      
      @config.asset_paths.each do |asset_path|
        sprockets_environment.append_path asset_path
      end

      if @config.asset_compress
        sprockets_environment.css_compressor = @config.css_compressor
        sprockets_environment.js_compressor  = @config.css_compressor
      end

      sprockets_environment.context_class.class_eval do
        def asset_path(path, options = {})
          ClassyAssets.asset_url_for(path)
        end
      end

      sprockets_environment
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
classy_assets-0.14.4 lib/classy_assets/sprockets.rb
classy_assets-0.14.2 lib/classy_assets/sprockets.rb
classy_assets-0.14.1 lib/classy_assets/sprockets.rb
classy_assets-0.14.0 lib/classy_assets/sprockets.rb
classy_assets-0.13.0 lib/classy_assets/sprockets.rb
classy_assets-0.12.0 lib/classy_assets/sprockets.rb
classy_assets-0.11.4 lib/classy_assets/sprockets.rb
classy_assets-0.11.3 lib/classy_assets/sprockets.rb
classy_assets-0.11.2 lib/classy_assets/sprockets.rb
classy_assets-0.11.1 lib/classy_assets/sprockets.rb
classy_assets-0.11.0 lib/classy_assets/sprockets.rb
classy_assets-0.10.0 lib/classy_assets/sprockets.rb