Kiv*_*360 8 javascript indentation express sublimetext2 pug
所以对于我的Express网站,我正在使用玉.所以我决定尝试修改我的布局文件,以便开始设计我的网站.我修改了原始布局代码(有效),但我开始在任何扩展布局的文件中得到缩进错误,如下所示:
500 Error: /home/kevin/Blue/views/layout.jade:6 4| p Hello World Invalid indentation, you can use tabs or spaces but not both
4| p Hello World
Invalid indentation, you can use tabs or spaces but not both
at Object.Lexer.indent (/home/kevin/Blue/node_modules/jade/lib/lexer.js:679:15)
at Object.Lexer.next (/home/kevin/Blue/node_modules/jade/lib/lexer.js:777:15)
at Object.Lexer.lookahead (/home/kevin/Blue/node_modules/jade/lib/lexer.js:107:46)
at Object.Parser.lookahead (/home/kevin/Blue/node_modules/jade/lib/parser.js:115:23)
at Object.Parser.peek (/home/kevin/Blue/node_modules/jade/lib/parser.js:92:17)
at Object.Parser.tag (/home/kevin/Blue/node_modules/jade/lib/parser.js:640:22)
at Object.Parser.parseTag (/home/kevin/Blue/node_modules/jade/lib/parser.js:624:17)
at Object.Parser.parseExpr (/home/kevin/Blue/node_modules/jade/lib/parser.js:198:21)
at Object.Parser.block (/home/kevin/Blue/node_modules/jade/lib/parser.js:592:25)
at Object.Parser.tag (/home/kevin/Blue/node_modules/jade/lib/parser.js:721:26)
Run Code Online (Sandbox Code Playgroud)
所以我的代码是这样的:
index.jade
extends layout
block content
p Hello World
Run Code Online (Sandbox Code Playgroud)
和
doctype 5
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
body
div#header
p This is the header
block content
Run Code Online (Sandbox Code Playgroud)
请记住,我没有拼写错误,我知道如何使用extends选项将文件链接在一起就好了.事实上,代码工作得很好,直到我开始搞乱布局文件.所有这些主要是一个缩进问题.我试着搞清楚它是否是我的文本编辑器导致问题,而且我一直没有成功搞清楚它是否是,因为我无法让代码再次运行.
我正在使用sublime text 2编辑器来编写这个jade代码.如果文本编辑器没有正确缩进,有人可以帮我学习如何解决它吗?
And*_*ion 52
在Sublime Text的右下角,应该有一个标签,Spaces: N或者Tab Size: N在哪里N是一个数字.选择此选项,您将看到将整个文档的缩进转换为使用制表符或空格的选项:
Convert Indentation to SpacesConvert Indentation to Tabs| 归档时间: |
|
| 查看次数: |
22992 次 |
| 最近记录: |