I am trying to use a mixin in the middle of a line of jade like this...
p some paragraph text !{ 'this'+'works' } but !{ +myMixin() } breaks it!
But it doesn't work. I can't figure out how to reference a mixin in the middle of a line of jade. Is it possible?
You need special way to use jade mixins inline:
p.
Hello I'm using #[+jadeMixin(param)] inline.
It's not possible to put a mixin in a sentence like that. What you can do is include blocks inside the 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
Which will render:
<p>This is a sentence <strong>with bold text</strong> and this is the rest of it</p>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.