1.0.0 • Published 2 years ago

@obciid/bem v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

BEM class names generator

BEM class names generator.

Install

npm i --save @obciid/bem
yarn add @obciid/bem

Uses

// CommonJS
const bem = require('@obciid/bem');
// ES6
import bem from '@obciid/bem';

Examples

const b = bem('button');

// Block
b(); // 'button'

// Element
b('icon'); // 'button__icon'

// Modifier
b({ type: 'text' });  // 'button button--type_open'
b({ primary: true });  // 'button button--primary'
b({ without: false });  // 'button'
b('text', { disabled : true }); // 'button__text button__text--disabled'
b(['disabled' ,'primary']); // 'button button--disabled button--primary'

b('icon', { name: 'check' }); // 'button__icon button__icon_name_check'