Skip to content

Commit

Permalink
Add debug output to theme rendering (#5195)
Browse files Browse the repository at this point in the history
Merge pull request 5195
  • Loading branch information
benbalter authored and jekyllbot committed Mar 5, 2018
1 parent 6130280 commit ced613c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
16 changes: 10 additions & 6 deletions lib/jekyll/renderer.rb
Expand Up @@ -169,12 +169,16 @@ def place_in_layouts(content, payload, info)
# 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
Expand Down
11 changes: 7 additions & 4 deletions lib/jekyll/theme.rb
Expand Up @@ -8,6 +8,8 @@ class Theme

def initialize(name)
@name = name.downcase.strip
Jekyll.logger.debug "Theme:", name
Jekyll.logger.debug "Theme source:", root
configure_sass
end

Expand All @@ -21,19 +23,19 @@ def root
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
Expand All @@ -56,6 +58,7 @@ def path_for(folder)
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

Expand Down

0 comments on commit ced613c

Please sign in to comment.