5

Referring to https://github.com/SyrusAkbary/pyjade/issues/27, it seems the jinja2 does not allow importing mixins from external files.

However, I got a helper.jade which has loads of mixins. If I need to use many different mixins from one file, does it mean I have to do it like:

- from 'helper.jade' import mixin_a, mixin_b, mixin_c, mixin_d...

mixin mixin_a(var1, var2, var3)
  div blah blah blah

which the import statement is rather inefficient.

Is there a better way for doing it. For example, similar to the following syntax?

- import 'helper.jade' as h

mixin h.mixin_a(var1, var2, var3)
  div blah blah blah
heartbreaker
  • 85
  • 2
  • 5

1 Answers1

0

I think a somewhat ugly workaround I found in a newer version of pyjade solves this: Including mixins in pyjade workaround

Community
  • 1
  • 1
Albin
  • 2,410
  • 2
  • 29
  • 27