我正在使用带有SublimeText3的livereload插件,当我打开SublimeText时会出现此错误:
解析代码段xml时遇到错误:期望>在文件中的Packages / User / livereload.sublime-snippet on line:6
以下是代码:
<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>
此处突出显示<
:...snipver=1"></'
。
请注意,它似乎并没有影响它的工作,因为LiveReload确实在工作,但每次打开SublimeText时都会很烦,我得到了这个错误并且无法确定原因。
答案 0 :(得分: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>