https://github.com/komlev/bemb
BEM util library
https://github.com/komlev/bemb
Last synced: 9 months ago
JSON representation
BEM util library
- Host: GitHub
- URL: https://github.com/komlev/bemb
- Owner: komlev
- License: mit
- Created: 2018-02-21T19:55:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:37:04.000Z (over 3 years ago)
- Last Synced: 2025-10-10T20:38:44.895Z (9 months ago)
- Language: JavaScript
- Size: 690 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bemb
*/'bembɪ/*
tiny BEM utility library
## API
There are three methods *getElement*, *getModifier*, *createBlock*
### getElement
Return you proper element class in BEM notation
```js
getElement('block', 'element') // block__element
```
Default separator is "**__**" but this could be changed with third parameter
```js
getElement('block', 'element', '--') // block--element
```
### getModifier
Return you proper modifier class in BEM notation
```js
getModifier('block__element', 'modifier') // block__element_modifier
```
Default separator is "**_**" but this could be changed with third parameter
```js
getModifier('block__element', 'modifier', '-') // block__element-modifier
```
### createBlock
Returns object with three methods *getElement*, *getModifier*, *setDivs*
```js
var block = createBlock('b');
block.getElement('e'); // b__e
block.getModifier('m'); // b_m
block.getModifier('m', 'e') // b__e_m
block.setDivs('--', '-');
block.getModifier('m', 'e') // b--e-m
```