Skip to content

Commit

Permalink
inject livereload on errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 31, 2015
1 parent cd34306 commit c166e28
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nikola/plugins/command/auto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
error_signal = signal('error')
refresh_signal = signal('refresh')

ERROR_N = '''<html>
<head>
</head>
<boody>
ERROR {}
</body>
</html>
'''

class CommandAuto(Command):
"""Start debugging console."""
Expand Down Expand Up @@ -223,7 +231,7 @@ def serve_static(self, environ, start_response):
start_response(b'200 OK', [(b'Content-type', mimetype)])
return self.inject_js(mimetype, fd.read())
start_response(b'404 ERR', [])
return ['404 {0}'.format(uri)]
return self.inject_js('text/html', ERROR_N.format(404).format(uri))

def inject_js(self, mimetype, data):
"""Inject livereload.js in HTML files."""
Expand Down

0 comments on commit c166e28

Please sign in to comment.