Module: Jekyll::Assets::Patches::CachedEnv

Includes:
Utils
Included in:
Sprockets::CachedEnvironment
Defined in:
lib/jekyll/assets/patches/cached.rb

Overview

– 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. –

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

activate, #external?, #external_asset, #find_assets_by_glob, #glob_paths, html, html_fragment, #in_cache_dir, #in_dest_dir, javascript?, make_https, manifest_files, new_uglifier?, old_sprockets?, #parse_liquid, #prefix_url, #raw_precompiles, #strip_paths, strip_secondary_content_type, strip_slashes, #url_asset, xml

Instance Attribute Details

#asset_configObject (readonly)

Returns the value of attribute asset_config.



22
23
24
# File 'lib/jekyll/assets/patches/cached.rb', line 22

def asset_config
  @asset_config
end

#jekyllObject (readonly)

Returns the value of attribute jekyll.



23
24
25
# File 'lib/jekyll/assets/patches/cached.rb', line 23

def jekyll
  @jekyll
end

#manifestObject (readonly)



21
22
23
# File 'lib/jekyll/assets/patches/cached.rb', line 21

def manifest
  @manifest
end

Instance Method Details

#find_assetObject



39
40
41
42
43
# File 'lib/jekyll/assets/patches/cached.rb', line 39

def find_asset(*)
  super.tap do |v|
    v&.environment = self
  end
end

#find_asset!(*a) ⇒ Object



46
47
48
49
50
# File 'lib/jekyll/assets/patches/cached.rb', line 46

def find_asset!(*a)
  load(resolve!(*a).first).tap do |v|
    v.environment = self
  end
end

#initialize(env) ⇒ self

– Patches initialize so we can give access to ‘#jekyll`. –

Parameters:

  • env (Env)

    the environment.

Returns:

  • (self)


30
31
32
33
34
35
36
# File 'lib/jekyll/assets/patches/cached.rb', line 30

def initialize(env)
  super

  @manifest = env.manifest
  @asset_config = env.asset_config
  @jekyll = env.jekyll
end