Set of helpers for composing and parsing BEM classNames.
Install
npm i -S rebem-classname
Usage
stringify
; const className = ;
props:
block
;// "beep"
elem
;// "beep__boop"
mods
;// "beep beep_foo_bar"
;// "beep beep_foo"
;// "beep__boop beep__boop_foo_bar"
mix
;// "beep boop__foo"
;// "beep boop__foo bar__baz bar__baz_test"
className
;// "boop beep"
parse
TODO
Environment variables
NODE_ENV
process.env.NODE_ENV
must be available. For example in webpack you can do this with DefinePlugin
:
plugins: 'process.env': NODE_ENV: JSON
Custom delimeters
Default delimeters are _
for modifiers and __
for elements, but you can change it with special environment variables:
plugins: 'process.env': REBEM_MOD_DELIM: JSON REBEM_ELEM_DELIM: JSON