0

I'm using the livereload plugin with SublimeText3 and when I open SublimeText get this error:

Error parsing snippet xml: expected > in file
Packages/User/livereload.sublime-snippet on line:6

Here's the code:

<snippet>
    <content>
<script>document.write('<script src="http://'
    + (location.host || 'localhost').split(':')[0]
    + ':35729/livereload.js?snipver=1"></'
    + 'script>')</script>
    </content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>livereload</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.html</scope> -->
</snippet>

It's highlighting the < here: ...snipver=1"></'.

Note that it doesn't seem to affect it working, because LiveReload is indeed working but it's annoying every time I open SublimeText I get that error and can't determine why.

4

1 回答 1

1

您的片段不是有效的 XML,您应该将您的内容包含在 CDATA 中:

<snippet>
    <content><![CDATA[
<script>document.write('<script src="http://'
    + (location.host || 'localhost').split(':')[0]
    + ':35729/livereload.js?snipver=1"></'
    + 'script>')</script>
    ]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>livereload</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <!-- <scope>source.html</scope> -->
</snippet>
于 2017-11-12T09:01:39.830 回答