Jade思考mixin是未定义的,但事实并非如此

时间:2012-04-12 14:55:56

标签: templates pug

为什么这不起作用?

extends layout

mixin WhyNotDefined(text)
  p #{text}

append content
  mixin WhyNotDefined('Hi')

我一直收到错误:WhyNotDefined_mixin is not defined

jade@0.20.3;节点v0.6.14

UPD。

愚蠢的我,mixins应该在块中定义。这有效:

extends layout

append content
  mixin WhyNotDefined(text)
    p #{text}

  mixin WhyNotDefined('Hi')

1 个答案:

答案 0 :(得分:2)

愚蠢的我,mixins应该在块中定义。这有效:

extends layout

append content
  mixin WhyNotDefined(text)
    p #{text}

  mixin WhyNotDefined('Hi')