Skip to content

Instantly share code, notes, and snippets.

@gruzzilkin
Last active August 29, 2015 14:00
Show Gist options
  • Save gruzzilkin/11171473 to your computer and use it in GitHub Desktop.
Save gruzzilkin/11171473 to your computer and use it in GitHub Desktop.
block('b-menu')(
tag()('ul'),
elem('item').tag()('li'),
elem('text').tag()('span')
)
{
block: 'b-menu',
content: [
{
text: 'One',
current: true,
submenu: true
},
{
text: 'Two'
},
{
text: 'Three'
}
].map(function(item){
var submenu = {
block: 'b-submenu',
mix: {block: 'b-menu', elem: 'submenu'},
content: 'Submenu here...'
};
var block = {
elem: 'item',
mods: {current: item.current || '', submenu: item.submenu || ''},
content: [
{
elem: 'text',
content: item.text || ''
},
item.submenu ? submenu : ''
]
};
return block;
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment