version 0.4.0
Describe the bug
For example, given an HTML file like this,
<style>h1 {color: blue}</style>
<h1>hello</h1>
the server will not reload when changes are made. Instead, the file has to be written like this:
<body>
<style>h1 {color: blue}</style>
<h1>hello</h1>
</body>
I think the issue is here:
|
const injectCandidates = [new RegExp('</head>', 'i'), new RegExp('</html>', 'i'), new RegExp('</body>', 'i')] |
|
let match |
|
|
|
for (let i = 0; i < injectCandidates.length; ++i) { |
|
match = injectCandidates[i].exec(data) |
|
if (match) { |
|
this.injectTag = match[0] |
|
break |
|
} |
|
} |
|
|
|
if (this.injectTag) { |
|
data = data.replace(this.injectTag, this.code + this.injectTag) |
|
} |
Looks like if it does not find </head>, </html>, or </body>, then it will not inject code.
I think it should have a last resort which is to simply append the injected script tag to the end of the file (this means it will implicitly be at the end of the <body> that the browser will generate).
version 0.4.0
Describe the bug
For example, given an HTML file like this,
the server will not reload when changes are made. Instead, the file has to be written like this:
I think the issue is here:
five-server/src/middleware/injectCode.ts
Lines 38 to 51 in 9571126
Looks like if it does not find
</head>,</html>, or</body>, then it will not inject code.I think it should have a last resort which is to simply append the injected script tag to the end of the file (this means it will implicitly be at the end of the
<body>that the browser will generate).