Node handlebars adds extra text node before rendered view

耗尽温柔 提交于 2019-12-06 02:40:12

I think I found the reason, please check your partial view file, whether there is BOM inserted in file, some editors will insert this in file with UTF-8, UTF-16 and UTF-32 format. so if you are using UTF-8, just remove the BOM will be good.

@leoyoo answer is the right one. I was about to post same question and found this.

On Chrome, source shows that white space character as seen below (red dot):

...and stringifies to 

I'm on Visual Studio and this is the default setting when files are saved:

When I change it to UTF-8 without signature (as seen below) that whitespace character dissapears.

On Visual Studio you do: File>>Save fileName.ext As and then drop-down next to Save button.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!