Don't insert livereload script tag after <header> tags

This commit is contained in:
Sam Hunter 2012-12-10 02:48:41 -05:00
parent ebeb331f0f
commit 25a0d6465c
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
require "rack/livereload"
class Rack::LiveReload
VERSION = '0.3.9'
VERSION = '0.4.0'
end

View File

@ -77,7 +77,7 @@ module Rack
template = ERB.new(::File.read(::File.expand_path('../../../skel/livereload.html.erb', __FILE__)))
if line['<head']
line.gsub!(/<head[^>]*>/) { |match| %{#{match}#{template.result(binding)}} }
line.gsub!(/<head(\s[^>])*>/) { |match| %{#{match}#{template.result(binding)}} }
end
headers["X-Rack-LiveReload"] = '1'