mirror of
https://github.com/jekyll/jekyll.git
synced 2026-02-16 17:45:51 -05:00
Initialize static files' data hash only if needed (#8188)
Merge pull request 8188
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user