Initialize static files' data hash only if needed (#8188)
Merge pull request 8188
This commit is contained in:
parent
bf568cc657
commit
c0fde30d4b
|
@ -4,7 +4,7 @@ module Jekyll
|
|||
class StaticFile
|
||||
extend Forwardable
|
||||
|
||||
attr_reader :relative_path, :extname, :name, :data
|
||||
attr_reader :relative_path, :extname, :name
|
||||
|
||||
def_delegator :to_liquid, :to_json, :to_json
|
||||
|
||||
|
@ -34,7 +34,6 @@ module Jekyll
|
|||
@collection = collection
|
||||
@relative_path = File.join(*[@dir, @name].compact)
|
||||
@extname = File.extname(@name)
|
||||
@data = @site.frontmatter_defaults.all(relative_path, type)
|
||||
end
|
||||
# rubocop: enable Metrics/ParameterLists
|
||||
|
||||
|
@ -113,6 +112,10 @@ module Jekyll
|
|||
true
|
||||
end
|
||||
|
||||
def data
|
||||
@data ||= @site.frontmatter_defaults.all(relative_path, type)
|
||||
end
|
||||
|
||||
def to_liquid
|
||||
@to_liquid ||= Drops::StaticFileDrop.new(self)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue