jade 不允许我在 mixin 中使用 include #{variable} [英] jade doesn't let me use include #{variable} in a mixin

查看:57
本文介绍了jade 不允许我在 mixin 中使用 include #{variable}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打印一个包含作为 mixin 的结果,但是 jade 想在它第一次读取 mixin 时解析包含.

I want to print an include as a result of a mixin, but jade wants to parse the include when it first reads the mixin.

mixin myHeader(name)
  div#{name} 
    h1 #{name}
      include #{name}


!!! html
  html
    head
    body
      +myHeader(#home)
      +myHeader(#schedule)
      +myHeader(#map)
      +myHeader(#lecturers)

我认为错误是告诉我 jade 找不到要包含在 mixin 中的 #{name}.

I think the error is telling me jade can't find #{name} to include in the mixin.

ENOENT,没有这样的文件或目录 '#{name}.jade'

ENOENT, no such file or directory '#{name}.jade'

推荐答案

Jade 不支持包含中的变量.此 stackoverflow 问题

Jade does not support variables in includes. A workaround is demonstrated in this stackoverflow question

这篇关于jade 不允许我在 mixin 中使用 include #{variable}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆