Optimize `Site#each_site_file` (#9187)

Merge pull request 9187
This commit is contained in:
Ashwin Maroli 2022-12-18 18:50:27 +05:30 committed by GitHub
parent 80fc7729ad
commit b2891a476e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 9 deletions

View File

@ -360,15 +360,9 @@ module Jekyll
end
def each_site_file
seen_files = []
%w(pages static_files_to_write docs_to_write).each do |type|
send(type).each do |item|
next if seen_files.include?(item)
yield item
seen_files << item
end
end
pages.each { |page| yield page }
static_files.each { |file| yield(file) if file.write? }
collections.each_value { |coll| coll.docs.each { |doc| yield(doc) if doc.write? } }
end
# Returns the FrontmatterDefaults or creates a new FrontmatterDefaults