javascript - 使用 Jade 时出现意外文本错误

标签 javascript node.js express pug

这是我的 jade 模板中的错误:

     Error: E:\Do\hello_express\node_notes\views\simple.jade:6
    4|      meta(charset="utf-8")
    5|      meta(name="viewport",content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no")
  > 6|      meta(http-equiv="X-UA-Compatible",content="IE=edge")    
    7|      title= #{title}
    8|      link(rel='stylesheet',href='http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css')
    9|      link(rel='stylesheet',href='stylesheets/notes.css')

    unexpected text     
        t

我的模板是这样的:

html
    head
        meta(charset="utf-8")
        meta(name="viewport",content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no")
        meta(http-equiv="X-UA-Compatible",content="IE=edge")    
        title= #{title}
        link(rel='stylesheet',href='http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css')
        link(rel='stylesheet',href='stylesheets/notes.css')
        script(type='text/javascript',src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js')
        script(type='text/javascript',src='http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js')
    body
        block content   

最佳答案

此错误是由于行尾的空格字符造成的。

关于javascript - 使用 Jade 时出现意外文本错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24870283/

相关文章:

javascript - 有没有一种简单的方法可以循环遍历一个对象,该对象的值是对象数组,以从这些对象的值生成列表

node.js - 使用 Sequelize 和 Postgres 从外键引用的另一个表中查询数据

javascript - 查询数组对象中的自动生成 Shortid 字段在 mongodb 上不起作用?

javascript - 如何将 plunker 连接到本地 Node.js 服务器?

node.js - 如何用 Mongoose 排除数组类型字段

node.js - 使用 Nodemailer,如何使用别名 gmail 帐户发送电子邮件?或一组谷歌套件服务器帐户?

javascript - Express 公共(public)目录和带宽

javascript - 使用 Javascript 验证联系我们表单,下拉菜单不返回 false

javascript - 为什么遍历 ES6 Map 不会在 ReactJS 中创建任何子元素?

javascript - POST 请求到 GitHub API