Comparing version 1.1.0 to 1.1.1
@@ -30,3 +30,9 @@ 'use strict'; | ||
if (err) return console.error(err); | ||
socket.emit('html', html.toString().split('\n').slice(1).join('\n')); | ||
var re = /<!DOCTYPE html>/; | ||
var doctype = re.exec(html); | ||
var cleanHtml = doctype ? html.slice(0, doctype.lastIndex) + html.slice(doctype.lastIndex + 15) : html; | ||
socket.emit('html', cleanHtml); | ||
}); | ||
@@ -33,0 +39,0 @@ }; |
{ | ||
"name": "hotloader", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "simple lib for fast html hotloading", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -35,9 +35,13 @@ const fs = require('fs') | ||
if (err) return console.error(err) | ||
const re = /<!DOCTYPE html>/ | ||
const doctype = re.exec(html) | ||
const cleanHtml = doctype | ||
? html.slice(0, doctype.lastIndex) + html.slice(doctype.lastIndex + 15) | ||
: html | ||
socket.emit( | ||
'html', | ||
html | ||
.toString() | ||
.split('\n') | ||
.slice(1) | ||
.join('\n') | ||
cleanHtml | ||
) | ||
@@ -44,0 +48,0 @@ }) |
204217
6815