JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 247454
  • Score
    100M100P100Q216339F
  • License MIT

Easy BEM class name generator

Package Exports

  • easy-bem

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (easy-bem) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Easy BEM class name generator

Simple and fast BEM class names generator.

NPM

Fork of bem-cn-fast that uses another delimiters (personally I like them more):

  • The element name is separated from the block name by a double underscore (__)
  • The modifier name is separated from the block or element name by a double dash (--)
  • The modifier value is separated from the modifier name by a single underscore (_)

Install

npm install --save easy-bem
yarn add easy-bem

Usage

import bem from 'easy-bem';
const b = bem('block');

b(); // -> 'block'
b('element'); // -> 'block__element'
b({ mod1: true, mod2: 'some-value' }); // -> 'block--mod1 block--mod2_some-value'
b('element', { mod1: true }); // -> 'block__element--mod1'