Use mixin inline in jade

I am trying to use mixin in the middle of a jade line like this ...

p some paragraph text !{ 'this'+'works' } but !{ +myMixin() } breaks it! 

But that will not work. I cannot figure out how to refer to the mixture in the middle of the jade line. Is it possible?

+6
source share
2 answers

You need a special way to use jade mixins inline:

 p. Hello I'm using #[+jadeMixin(param)] inline. 
+13
source

It is impossible to put mixin in such a sentence. What you can do is enable blocks inside mixin and use pikes | for plain text.

 mixin myMixin() strong block p This is a sentence +myMixin() | with bold text | and this is the rest of it 

What will be displayed:

 <p>This is a sentence <strong>with bold text</strong> and this is the rest of it</p> 
+2
source

Source: https://habr.com/ru/post/957334/


All Articles