1.0.0 • Published 5 years ago

abem v1.0.0

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

abem

Build Status Coverage Status Standard - JavaScript Style Guide npm downloads

Extremely simple and small (~0.25Kb minified) ABEM class name generator. Developed for using with babel-plugin-transform-jsx-abem.

Note: This plugin doesn't apply any string transformation. camelCase should be applied earlier on.

Installation

npm install abem

Syntax

const _abem = abem([options])
_abem(block[, element, modifiers, mixins])
argtype
optionsobject (default: { separators: { element: '__', modifier: '-' } })
blockstring
elementstring | null
modifiersstring | array | object | null
mixinsstring | array | object | null

Examples

let _abem = abem()
_abem('o-animal', 'elephant')
// "o-animal__elephant"

_abem('o-animal', 'elephant', ['mod1', 'mod2'])
// "o-animal__elephant -mod1 -mod2"

_abem('o-animal', 'elephant', { mod1: true, mod2: false }, ['mix'])
// "o-animal__elephant -mod1 mix"

_abem('o-animal', null, null, { mix: true })
// "o-animal mix"

_abem = abem({ separators: { element: '___', modifier: '--' } })
_abem('o-animal', 'elephant', 'mod')
// "o-animal___elephant --mod"

Send some love

You like this package?

Buy me a coffee