Expose collection static files via `site.static_files` (#8961)
Merge pull request 8961
This commit is contained in:
parent
79869e7225
commit
9d86974e1f
|
@ -65,6 +65,7 @@ module Jekyll
|
||||||
read_static_file(file_path, full_path)
|
read_static_file(file_path, full_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
site.static_files.concat(files) unless files.empty?
|
||||||
sort_docs!
|
sort_docs!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,13 @@ module Jekyll
|
||||||
documents.select(&:write?)
|
documents.select(&:write?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get the to be written static files
|
||||||
|
#
|
||||||
|
# Returns an Array of StaticFiles which should be written
|
||||||
|
def static_files_to_write
|
||||||
|
static_files.select(&:write?)
|
||||||
|
end
|
||||||
|
|
||||||
# Get all the documents
|
# Get all the documents
|
||||||
#
|
#
|
||||||
# Returns an Array of all Documents
|
# Returns an Array of all Documents
|
||||||
|
@ -353,7 +360,7 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def each_site_file
|
def each_site_file
|
||||||
%w(pages static_files docs_to_write).each do |type|
|
%w(pages static_files_to_write docs_to_write).each do |type|
|
||||||
send(type).each do |item|
|
send(type).each do |item|
|
||||||
yield item
|
yield item
|
||||||
end
|
end
|
||||||
|
|
|
@ -735,4 +735,13 @@ class TestSite < JekyllUnitTest
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "static files in a collection" do
|
||||||
|
should "be exposed via site instance" do
|
||||||
|
site = fixture_site("collections" => ["methods"])
|
||||||
|
site.read
|
||||||
|
|
||||||
|
assert_includes site.static_files.map(&:relative_path), "_methods/extensionless_static_file"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue