Minor tweak to #1695
This commit is contained in:
parent
b0582bcebf
commit
4594f46fb8
8 changed files with 20 additions and 33 deletions
|
@ -398,7 +398,6 @@ module Middleman
|
|||
execute_callbacks(:before_shutdown)
|
||||
end
|
||||
|
||||
|
||||
# Set attributes (global variables)
|
||||
#
|
||||
# @deprecated Prefer accessing settings through "config".
|
||||
|
|
|
@ -37,7 +37,8 @@ module Middleman
|
|||
engine = extension[1..-1].to_sym
|
||||
|
||||
# Store last engine for later (could be inside nested renders)
|
||||
context.current_engine, engine_was = engine, context.current_engine
|
||||
context.current_engine = engine
|
||||
engine_was = context.current_engine
|
||||
|
||||
# Save current buffer for later
|
||||
buf_was = context.save_buffer
|
||||
|
|
|
@ -21,7 +21,7 @@ module Middleman
|
|||
).to_bind_addresses
|
||||
|
||||
@port = server_information.port
|
||||
@server_name = server_information.server_name.dup unless server_information.server_name == nil
|
||||
@server_name = server_information.server_name.dup unless server_information.server_name.nil?
|
||||
|
||||
@site_addresses = ServerUrl.new(
|
||||
hosts: server_information.site_addresses,
|
||||
|
|
|
@ -133,9 +133,7 @@ module Middleman
|
|||
locs[:current_path] ||= destination_path
|
||||
|
||||
# Certain output file types don't use layouts
|
||||
unless opts.key?(:layout)
|
||||
opts[:layout] = false if ext != '.html'
|
||||
end
|
||||
opts[:layout] = false unless opts.key?(:layout) || !ext != '.html'
|
||||
|
||||
renderer = ::Middleman::TemplateRenderer.new(@app, file_descriptor[:full_path].to_s)
|
||||
renderer.render(locs, opts)
|
||||
|
|
|
@ -182,14 +182,8 @@ module Middleman
|
|||
# @return [void]
|
||||
Contract Any
|
||||
def poll_once!
|
||||
removed = @files.keys
|
||||
|
||||
updated = []
|
||||
|
||||
::Middleman::Util.all_files_under(@directory.to_s).each do |filepath|
|
||||
removed.delete(filepath)
|
||||
updated << filepath
|
||||
end
|
||||
updated = ::Middleman::Util.all_files_under(@directory.to_s)
|
||||
removed = @files.keys.reject { |p| updated.include?(p) }
|
||||
|
||||
update(updated, removed)
|
||||
|
||||
|
@ -314,16 +308,10 @@ module Middleman
|
|||
# @return [Array] All related file paths, not including the source file paths.
|
||||
Contract ArrayOf[String] => ArrayOf[String]
|
||||
def find_related_files(files)
|
||||
files.map do |file|
|
||||
related_files = []
|
||||
|
||||
# If any SASS file changes, reload all non-partials
|
||||
if file =~ /\.(sass|scss)$/
|
||||
related_files |= Dir[File.join(@directory, app.config[:css_dir], '**/[^_]*.{scss,sass}')]
|
||||
end
|
||||
|
||||
related_files
|
||||
end.flatten.uniq - files
|
||||
files.flat_map do |file|
|
||||
# If any partial file changes, reload all non-partials
|
||||
Dir[File.join(@directory, app.config[:source], "**/[^_]*.#{File.extname(file)}")] if File.basename(file).start_with?('_')
|
||||
end.compact.uniq - files
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -42,7 +42,8 @@ module Middleman
|
|||
# @api private
|
||||
# @return [String] The old buffer.
|
||||
def save_buffer
|
||||
@_out_buf, buf_was = '', @_out_buf
|
||||
buf_was = @_out_buf
|
||||
@_out_buf = ''
|
||||
buf_was
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue