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
private
def validate_layout(layout)
return unless invalid_layout?(layout)
Jekyll.logger.warn(
"Build Warning:",
"Layout '#{document.data["layout"]}' requested "\
"in #{document.relative_path} does not exist."
)
if invalid_layout?(layout)
Jekyll.logger.warn(
"Build Warning:",
"Layout '#{document.data["layout"]}' requested "\
"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
# Render layout content into document.output

View File

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