Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including mixins in pyjade workaround

Tags:

pyjade

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

Are there any good workarounds or alternative solutions?

like image 903
Albin Avatar asked Oct 20 '22 21:10

Albin


1 Answers

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)

like image 87
Albin Avatar answered Oct 22 '22 22:10

Albin