Sha256: 0fbbfcd0632f6a6dd3cb413e10198fec7f091880144ecf1954aa14107d2cb1bc
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
# Frozen-string-literal: true # Copyright: 2012 - 2017 - MIT License # Encoding: utf-8 require_relative "../utils" module Jekyll module Assets module Patches # -- # Patches `Sprockets::CachedEnvironment` with some of # the stuff that we would like available. Including our # `Util` methods, the `#manifest`, the `#asset_config`, # and even `#jekyll`, so that we can remain fast while # having some of the stuff that we need access to. # -- module CachedEnv include Utils # -- attr_reader :manifest attr_reader :asset_config attr_reader :jekyll # -- # @param [Env] env the environment. # Patches initialize so we can give access to `#jekyll`. # @return [self] # -- def initialize(env) super @manifest = env.manifest @asset_config = env.asset_config @jekyll = env.jekyll end # -- def find_asset(*) super.tap do |v| v.environment = self end end # -- def find_asset!(*args) load(resolve!(*args).first).tap do |v| v.environment = self end end end end end end # -- module Sprockets class CachedEnvironment prepend Jekyll::Assets::Patches::CachedEnv end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jekyll-assets-3.0.5 | lib/jekyll/assets/patches/cached.rb |
jekyll-assets-3.0.4 | lib/jekyll/assets/patches/cached.rb |
jekyll-assets-3.0.3 | lib/jekyll/assets/patches/cached.rb |