1.2.12 • Published 4 years ago

@jahed/bem v1.2.12

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@jahed/bem

Travis npm Patreon Liberapay

Functions for using BEM in CSS and CSS Modules.

Installation

# NPM
npm install @jahed/bem

# Yarn
yarn add @jahed/bem

Usage

import { bem } from '@jahed/bem'

const className = ".MyElement .MyElement--color--red .MyElement--active"
// same as
const className = bem('MyElement', {
  color: 'red',
  active: true,
  disabled: false
})

For more thorough examples, see the tests and blog posts linked above.

API

For complete API documentation, see the documentation website.

bem(block: string, modifiers: object<string, (boolean|number|string)?>): string

Generates BEM-compliant class names for the given block (or element) with modifiers.

Examples


bemModule(cssModuleLocals): bem

Generates a bem-compliant function which maps the resulting class names to the given cssModuleLocals map.

Examples


join(...string): string

Joins the given strings with a whitespace (), filtering any falsy values (such as undefined, null, false, '').

Examples


License

MIT

1.2.12

4 years ago

1.2.11

4 years ago

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago