Module: Jekyll::Assets::Patches::ObsoleteFiles

Included in:
Cleaner
Defined in:
lib/jekyll/assets/patches/obsolete.rb

Overview

– Patches Jekyll’s obsolete files so that we can remove assets that we have used through the manifest. We expect the user to keep that manifest available, regardless of what’s going on in their stuff. –

Instance Method Summary collapse

Instance Method Details

#obsolete_files(*args) ⇒ Array<String>

– Gives a list of files that should be removed, unless used. –

Parameters:

  • args (Object)

    whatever Jekyll takes.

Returns:

  • (Array<String>)


20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/jekyll/assets/patches/obsolete.rb', line 20

def obsolete_files(*args)
  extras = Utils.manifest_files(site.sprockets)
  extras.concat(site.sprockets.raw_precompiles
    .map { |v| v.values_at(:dst, :full_dst) }
      .flatten.uniq)

  super(*args).reject do |v|
    v == site.sprockets.in_dest_dir || \
      v == site.sprockets.manifest.filename || \
      extras.include?(v)
  end
end