Add debug output to theme rendering (#5195)

Merge pull request 5195
This commit is contained in:
Ben Balter 2018-03-05 10:15:36 -05:00 committed by jekyllbot
parent 6130280f8b
commit ced613c678
2 changed files with 17 additions and 10 deletions

View File

@ -169,12 +169,16 @@ module Jekyll
# Returns nothing # Returns nothing
private private
def validate_layout(layout) def validate_layout(layout)
return unless invalid_layout?(layout) if invalid_layout?(layout)
Jekyll.logger.warn( Jekyll.logger.warn(
"Build Warning:", "Build Warning:",
"Layout '#{document.data["layout"]}' requested "\ "Layout '#{document.data["layout"]}' requested "\
"in #{document.relative_path} does not exist." "in #{document.relative_path} does not exist."
) )
elsif !layout.nil?
layout_source = layout.path.start_with?(site.source) ? :site : :theme
Jekyll.logger.debug "Layout source:", layout_source
end
end end
# Render layout content into document.output # Render layout content into document.output

View File

@ -8,6 +8,8 @@ module Jekyll
def initialize(name) def initialize(name)
@name = name.downcase.strip @name = name.downcase.strip
Jekyll.logger.debug "Theme:", name
Jekyll.logger.debug "Theme source:", root
configure_sass configure_sass
end end
@ -21,19 +23,19 @@ module Jekyll
end end
def includes_path def includes_path
path_for "_includes".freeze @includes_path ||= path_for "_includes".freeze
end end
def layouts_path def layouts_path
path_for "_layouts".freeze @layouts_path ||= path_for "_layouts".freeze
end end
def sass_path def sass_path
path_for "_sass".freeze @sass_path ||= path_for "_sass".freeze
end end
def assets_path def assets_path
path_for "assets".freeze @assets_path ||= path_for "assets".freeze
end end
def configure_sass def configure_sass
@ -56,6 +58,7 @@ module Jekyll
def realpath_for(folder) def realpath_for(folder)
File.realpath(Jekyll.sanitized_path(root, folder.to_s)) File.realpath(Jekyll.sanitized_path(root, folder.to_s))
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
Jekyll.logger.warn "Invalid theme folder:", folder
nil nil
end end