bemmy
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

bemmy

Dependency-free utility to compose CSS classnames following the BEM convention.

Installation

npm install bemmy

Usage

Basic examples

import bemmy from 'bemmy';

const bem = bemmy('component');

bem(); // block
// -> 'component'

bem('content'); // block + element
// -> 'component__content'

bem(null, 'tall'); // block + modifier
// -> 'component component--tall'

bem('content', 'tall'); // block + element + modifier
// -> 'component__content component__content--tall'

bem('content', { tall: true, green: false }); // modifier object
// -> 'component__content component__content--tall

bem('content', ['tall']); // modifier array
// -> 'component__content component__content--tall'

bem(null, null, 'some-class', 'another-class'); // additional classes
// -> 'component some-class another-class'

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.334latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.334
1.0.10
1.0.01

Package Sidebar

Install

npm i bemmy

Weekly Downloads

35

Version

1.0.3

License

ISC

Unpacked Size

10.8 kB

Total Files

5

Last publish

Collaborators

  • motogoozy