0.3.4 • Published 6 years ago

@maxwellmri/bem v0.3.4

Weekly downloads
18
License
MIT
Repository
github
Last release
6 years ago

bem

bem is a small helper function for managing BEM classes.

Install

npm install --save @maxwellmri/bem

Usage

bem can be used 3 ways.

  1. With an array
const b = bem("Block");
b(["&__component"]) // returns Block__component
ub(["&__component", "&--modified"]) // returns Block__component Block--modifier
  1. With an string
const b = bem("Block");
b("&__component") // returns Block__component
  1. With an object (for conditional classes)
const b = bem("Block");
b({ "&__component": true, "&--disabled": false }) // returns Block__component
b({ "&__component": true, "&--disabled": true }) // returns Block__component Block--disabled
  1. With multiple arguments
const b = bem("Block");
b(["&", "&--disabled"], "random") // returns Block Block--disabled random
b(["&", "&--disabled"], { "fizz": true, "buzz": false }) // returns Block Block--disabled fizz
0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago