将玉与node&express结合使用会产生意外的令牌“缩进”

时间:2018-07-09 13:10:52

标签: node.js express pug template-engine

我有一个在node&express中包含jade的Web应用程序 所以我在布局和index.jade中使用制表符进行缩进 像下面这样:

layout.jade

    doctype html
    html
    head
        title="website"
        meta(property='og:title', content='The Rock')
        meta(property='og:type', content='video.movie')
        meta(property='og:url',content='http://')
        meta(property='og:image', content='http://')
        meta(name='twitter:card', content='summary')
        meta(name='twitter:domain', content='dz-marriage.dz')
        meta(name='twitter:title', property='og:title', itemprop='title name', content='dz-marriage where people prepare for marriage')
        meta(name='twitter:description', property='og:description', itemprop='description', content='website')
    body.home-page
        block content

和index.jade

extends layout

block content
    #notify-container
    #custom-header  
    header.top-bar
        .top-bar-container

我得到了这个味精:

error: D:\mejn\views\index.jade:3
    1|  extends layout
    2| 
  > 3|  block content
    4|      #notify-container
    5|      #custom-header
    6|      //

unexpected token "indent"
    at Parser.parseExpr (D:\mejn\node_modules\jade\lib\parser.js:254:15)
    at Parser.parse (D:\mejn\node_modules\jade\lib\parser.js:122:25)
    at parse (D:\mejn\node_modules\jade\lib\index.js:104:21)
    at Object.exports.compile (D:\mejn\node_modules\jade\lib\index.js:205:16)
    at handleTemplateCache (D:\mejn\node_modules\jade\lib\index.js:174:25)
    at Object.exports.renderFile (D:\mejn\node_modules\jade\lib\index.js:380:10)
    at Object.exports.renderFile (D:\mejn\node_modules\jade\lib\index.js:370:21)
    at View.exports.__express [as engine] (D:\mejn\node_modules\jade\lib\index.js:417:11)
    at View.render (D:\mejn\node_modules\express\lib\view.js:135:8)
    at tryRender (D:\mejn\node_modules\express\lib\application.js:640:10)

那么问题出在哪里

0 个答案:

没有答案