Skip to content

Commit

Permalink
enable hot reload on all html pages
Browse files Browse the repository at this point in the history
  • Loading branch information
okwolf committed Apr 22, 2019
1 parent 5eeb815 commit fef16ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions examples/root/subpage.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>
Hot reload should work for pages other than index.html.
</h1>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "srvs",
"version": "0.5.1",
"version": "0.5.2",
"description": "Zero dependency dev server",
"files": [
"src"
Expand Down
4 changes: 2 additions & 2 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ module.exports = ({
.catch(() =>
streamPath({ filePath: path.resolve(docPath, INDEX_HTML_FILE) })
)
.then(({ fileName, fileStream, mime }) => {
.then(({ fileStream, mime }) => {
if (mime) {
response.setHeader("Content-Type", mime);
}
if (fileName === INDEX_HTML_FILE) {
if (mime === "text/html") {
response.write(HOT_SCRIPT);
}
fileStream.pipe(response);
Expand Down

0 comments on commit fef16ab

Please sign in to comment.