intesso / connect-livereload

connect middleware for adding the livereload script to the response
MIT License
305 stars 53 forks source link

Fix injection bug when html is minified #50

Closed eirikurn closed 10 years ago

eirikurn commented 10 years ago

Make doctype regex less greedy, otherwise it may inject in an illegal place. Example:

<!DOCTYPE html><html><head><style>
<script>//<![CDATA[
document.write('<script src="//' + (location.hostname || 'localhost') + ':35729/livereload.js?snipver=1"><\/script>')
//]]></script>
.some-static-css {
  /* ... */
}
</style>
andineck commented 10 years ago

thx man!