Including mixins in pyjade workaround

大兔子大兔子 提交于 2019-12-10 15:44:30

问题


As mentioned in the github issue #70 including mixins aren't supported.

Are there any good workarounds or alternative solutions?


回答1:


Pyjade's implementation of include doesn't support mixins, but "extends" does, although you have to use a "block". So what you could do if you just need to import one file:

extends mixins.jade
block layout
  +link("example", "http://example.com/")

mixins.jade:

mixin link(text, url)
  a(href=url)= text

block layout

(Answering my own question, because I searched hard before figuring this out myself and thought it could be helpful to others)



来源:https://stackoverflow.com/questions/27278199/including-mixins-in-pyjade-workaround

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!