Skip to content

Instantly share code, notes, and snippets.

@tenorok
Last active August 29, 2015 14:10
Show Gist options
  • Save tenorok/4b48f4115bd6d0bbb331 to your computer and use it in GitHub Desktop.
Save tenorok/4b48f4115bd6d0bbb331 to your computer and use it in GitHub Desktop.
// @readme https://github.com/tenorok/bemer#%D0%9C%D0%B5%D1%82%D0%BE%D0%B4-modules
// # Module Selector
// @jsdoc http://tenorok.github.io/bemer/jsdoc/module-Selector-Selector.html
var Selector = bemer.modules('Selector');
new Selector('button')
.mod('bold', true)
.toString(); // → "button_bold"
new Selector('button')
.mod('theme', 'normal')
.elem('text')
.toString(); // → "button_theme_normal__text"
new Selector('button')
.elem('text')
.elemMod('size', 'xl')
.toString(); // → "button__text_size_xl"
// # Module Node
// @jsdoc http://tenorok.github.io/bemer/jsdoc/module-Node-Node.html
var Node = bemer.modules('Node');
new Node({
block: 'button',
mods: {
bold: true,
theme: 'normal'
}
}).getClass(); // → ["button", "button_bold", "button_theme_normal"]
new Node({
block: 'button',
elem: 'text',
elemMods: { bold: true },
mix: [{ block: 'select', mods: { size: 'm' }}]
}).getClass(); // → ["button__text", "button__text_bold", "select", "select_size_m"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment