Answer the question
In order to leave comments, you need to log in
How to write a mixin function for a list in pug?
I'm learning Pug. I wanted to write a mixin to quickly create a navigation list. It is necessary that the name and href differ in the name.
Here is the mixin:
mixin list([...names], [...links])
each name in names
li
each link in links
a(href=link)=name
+list(['Home', 'About Us', 'Order', 'Contacts'], ['_Home', '_About Us', '_Order', '_Contacts'])
<li>
<a href="_Home">Home</a><a href="_About Us">Home</a><a href="_Order">Home</a><a href="_Contacts">Home</a>
</li>
<li>
<a href="_Home">About Us</a><a href="_About Us">About Us</a><a href="_Order">About Us</a><a href="_Contacts">About Us</a>
</li>
<li><a href="_Home">Order</a><a href="_About Us">Order</a><a href="_Order">Order</a><a href="_Contacts">Order</a>
</li>
<li>
<a href="_Home">Contacts</a><a href="_About Us">Contacts</a><a href="_Order">Contacts</a><a href="_Contacts">Contacts</a>
</li>
<li>
<a href="_Home">Home</a>
</li>
<li>
<a href="_About Us">About Us</a>
</li>
<li>
<a href="_Order">Order</a>
</li>
<li>
<a href="_Home">Contacts</a>
</li>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question