Skip to content

Instantly share code, notes, and snippets.

@allusis
Created September 15, 2017 03:45
Show Gist options
  • Save allusis/97479d7927edc255621e4e3541e3c523 to your computer and use it in GitHub Desktop.
Save allusis/97479d7927edc255621e4e3541e3c523 to your computer and use it in GitHub Desktop.
Pug navigation mixin
- var PrimaryNavItems = [{'url':'home','title':'Home','img':'nav','key':'home'},{'url':'inputs','title':'Inputs','img':'nav','key':'inputs'},{'url':'buttons','title':'Buttons','img':'nav','key':'buttons'},{'url':'cards','title':'Cards','img':'nav','key':'cards'},{'url':'icons','title':'Icons','img':'nav','key':'icons'},{'url':'collapse','title':'Collapse','img':'nav','key':'collapse'}];
each page,i in PrimaryNavItems
if currentPage === page.url
a(class="active", href= page.url + '.html')
svg(class='nav-icon', aria-hidden="true")
use(xlink:href= 'img/sprites/nav.svg#' + page.key, xmlns:xlink="http://www.w3.org/1999/xlink")
span.title= page.title
else
a(href= page.url + '.html')
svg(class='nav-icon', aria-hidden="true")
use(xlink:href= 'img/sprites/nav.svg#' + page.key, xmlns:xlink="http://www.w3.org/1999/xlink")
span.title= page.title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment