Answer the question
In order to leave comments, you need to log in
How to set a unique class for the last element?
Is it possible in pug/jade to assign a unique class to the last element of an array? It's kind of like last-child in css. Are there such opportunities here?
mixin breadcrumbs(...items)
ol.breadcrumbs
each item in items
li.breadcrumbs__item
a(href='#')= item
Answer the question
In order to leave comments, you need to log in
mixin list(items)
ul.breadcrumbs
each item, index in items
li.breadcrumbs__item(class= (items.length === index + 1) ? 'breadcrumbs__item_last' : false )
a(href=item.href)= item.text
+list([{href: '/one', text: 'раз'}, {href: '/two', text: 'два'}])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question