Sha256: 53fd8f74b08281276f047eea565499aab336143b77f45e50f4bd45bf5cc61cf5

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

# 3rd-party
require "sprockets"

module Jekyll
  module Assets
    module Patches
      module IndexPatch
        def self.included(base)
          base.class_eval do
            alias_method :__orig_find_asset, :find_asset
            alias_method :find_asset, :__wrap_find_asset
          end
        end

        def __wrap_find_asset(path, options = {})
          __orig_find_asset(path, options).tap do |asset|
            asset.instance_variable_set :@site, @environment.site if asset
          end
        end
      end
    end
  end
end

Sprockets::Index.send :include, Jekyll::Assets::Patches::IndexPatch

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jekyll-assets-1.0.0 lib/jekyll/assets/patches/index_patch.rb
jekyll-assets-1.0.0.pre.alpha1 lib/jekyll/assets/patches/index_patch.rb
jekyll-assets-1.0.0.pre.alpha0 lib/jekyll/assets/patches/index_patch.rb