Including a scam file causes an error, but jade works fine

Running here to meet. Here I have a pretty simple jade / pug:

extends base.pug

block vars
    - var title = 'Home'

block body
    header
        include ./includes/header.pug

A quick note, just using the extension database (without the extension) just doesn't work. But this includes the following error:

TypeError: Cannot read property 'replace' of undefined
   at before (/var/node/website/node_modules/pug-linker/index.js:104:48)
   at walkAST (/var/node/website/node_modules/pug-walk/index.js:13:26)
   at /var/node/website/node_modules/pug-walk/index.js:21:16
   at Array.map (native)
   at walkAST (/var/node/website/node_modules/pug-walk/index.js:20:29)
   at walkAST (/var/node/website/node_modules/pug-walk/index.js:33:21)
   at /var/node/website/node_modules/pug-walk/index.js:21:16
   at Array.map (native)
   at walkAST (/var/node/website/node_modules/pug-walk/index.js:20:29)
   at /var/node/website/node_modules/pug-walk/index.js:21:16
   at Array.map (native)
   at walkAST (/var/node/website/node_modules/pug-walk/index.js:20:29)
   at applyIncludes (/var/node/website/node_modules/pug-linker/index.js:102:10)
   at link (/var/node/website/node_modules/pug-linker/index.js:21:9)
   at compileBody (/var/node/website/node_modules/pug/lib/index.js:84:11)
   at Object.exports.compile (/var/node/website/node_modules/pug/lib/index.js:164:16)

But changing this to:

extends base.pug

block vars
    - var title = 'Home'

block body
    header
        include ./includes/header.jade

Works great. The contents of header.jade and header.pug are the same, so I'm a bit puzzled here. Some help would be appreciated.

Thank,

PS: The search showed: https://github.com/pugjs/pug-linker/issues/13 - it seems to be a mistake, but not sure how it could be.

+4
source share
2 answers

, , -! , , , .jade.

+4

Jade to Pug , . ( ) #{something} , JavaScript.

,

a(href="#{link}")
a(href='before#{link}after')

a(href=link)
a(href=`before${link}after`) //(on Node.js/io.js ≥ 1.0.0)
a(href='before' + link + 'after') //(everywhere)

: issue .

0

All Articles