Reduce array allocations from `StaticFile#path` (#8083)
Merge pull request 8083
This commit is contained in:
parent
539e712c41
commit
f0ab09968e
|
@ -40,6 +40,7 @@ module Jekyll
|
||||||
|
|
||||||
# Returns source file path.
|
# Returns source file path.
|
||||||
def path
|
def path
|
||||||
|
@path ||= begin
|
||||||
# Static file is from a collection inside custom collections directory
|
# Static file is from a collection inside custom collections directory
|
||||||
if !@collection.nil? && !@site.config["collections_dir"].empty?
|
if !@collection.nil? && !@site.config["collections_dir"].empty?
|
||||||
File.join(*[@base, @site.config["collections_dir"], @dir, @name].compact)
|
File.join(*[@base, @site.config["collections_dir"], @dir, @name].compact)
|
||||||
|
@ -47,6 +48,7 @@ module Jekyll
|
||||||
File.join(*[@base, @dir, @name].compact)
|
File.join(*[@base, @dir, @name].compact)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Obtain destination path.
|
# Obtain destination path.
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in New Issue