【问题标题】:Problem with Pug pre-processor and indentationPug 预处理器和缩进的问题
【发布时间】:2020-12-23 23:18:08
【问题描述】:

我在监视文件时遇到问题

以及出现的错误 =>

Error: .//index.pug:2:1
    1| doctype html
  > 2|    html
-------^
    3|
    4|      head
    5|

unexpected token "indent"
    at makeError (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug-error\index.js:32:13)
    at Parser.error (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug-parser\index.js:53:15)
    at Parser.parseExpr (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug-parser\index.js:264:14)
    at Parser.parse (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug-parser\index.js:112:25)
    at parse (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug-parser\index.js:12:20)
    at Object.parse (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug\lib\index.js:126:22)
    at Function.loadString [as string] (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug-load\index.js:45:21)
    at compileBody (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug\lib\index.js:86:18)
    at Object.exports.compile (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug\lib\index.js:242:16)
    at handleTemplateCache (C:\Users\amb\AppData\Roaming\npm\node_modules\pug-cli\node_modules\pug\lib\index.js:215:25)

请帮忙?

【问题讨论】:

    标签: html pug preprocessor


    【解决方案1】:

    您可能在第 1 行的末尾有一个制表符,或者处理器希望在第 2 行的开头有一个制表符,而您有空格(反之亦然)

    【讨论】:

      【解决方案2】:
      doctype html
      
      html
        head
          meta
          title
      
        body
          h1 Tag
      
      //- Remember
        //- Use 2 Spaces Tab
        //- Be sure to check any tabs or spaces at the end of line
      
      //- doctype html and html - without any tabs
      
      //- head and body - with 1 tab or 2 spaces
      
      //- meta, title and h1- with 2 tab or 4 spaces
      

      【讨论】:

      • 请提供问题。在描述中写下你想要的。
      猜你喜欢
      • 2021-09-13
      • 1970-01-01
      • 2016-04-09
      • 2013-03-30
      • 2019-07-12
      • 1970-01-01
      • 1970-01-01
      • 2022-01-01
      • 2015-11-24
      相关资源
      最近更新 更多