Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

A small helper function for managing BEM classes.

License

Notifications You must be signed in to change notification settings

maxwellplus/bem

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A small helper function for managing BEM classes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.