Skip to content

4.0.0 Migrate package to ESM. Simplify API

Compare
Choose a tag to compare
@slavik-chapelskyi slavik-chapelskyi released this 13 Jul 13:43
· 132 commits to master since this release

BREAKING CHANGE:
Remove b & blazeHelper. Use the return function of createBlock instead.
The definition has not changed, only how its get called

Usage

import {b, createBlock} from '@shelf/bem'
// before
const block = createBlock('heading') 
b(block)

// after 
import {createBlock} from '@shelf/bem'
const b = createBlock('heading') 
b()

All changes

Before After
b(block) b()
b(block, 'list') b('list')
b(block, 'list-item', 'active') b('list-item', {active: true})
b(block, '', 'active') b({active: true})
b(block, '', ['active', 'hovered']) b({active: true, hovered: true})
b(block, 'list-item', [isActive && 'active', isHovered && 'hovered']) b('list-item', {active: isActive, hovered: isHovered})

Codemod for updating https://github.com/shelfio/codemod#shelf-bem