In my HTML I have <pre><code>some code</code></pre>. Additionally I am using Vue.js which does not allow <script> tags inside document body .
For some reason I do not understand and found response yet, browser sync seems to inject a script tag into the first pre tag is found.
The script tag looks like this:
<script id="__bs_script__">//<![CDATA[
--
聽 | document.write("<script async src='/browser-sync/browser-sync-client.js?v=2.18.13'><\/script>".replace("HOST", location.hostname));
聽 | //]]></script>
Now, I cannot be sure if it is a bug or a feature, but this is causing me issues specifically with Vue.js (and probably with some other JS frameworks).
Create an HTML document which includes <pre> tags un the body (at least one). Load that HTML document using BrowserSync, this will result in a script inserted just before the <pre> close tag.
Windows 10 64 bit
+1
Use this:
snippetOptions: {
rule: {
match: /<\/body>/i
}
}
@JuanDMeGon Are you using Browsersync via laravel-mix?
Yes, I do. Do you think this is related to Laravel-Mix?
I just "resolved" removing the <pre> tags. Do not know if it was resolved already (was long time ago :P)
@JuanDMeGon yes. Laravel-Mix has a custom regex rule for browsersync to </pre> tags.
I have a PR to fix because I've run into the same issue: https://github.com/JeffreyWay/laravel-mix/pull/2227
Most helpful comment
Use this: