HTML JS ClassNames helper
Simple, no-dependency helper for building BEM html classes.
Simple module, and simple readme.How to use it?
Signature is as follows/**
* @param {string} baseName
* @param {Object<string, boolean>} extras
* @return {string}
*/
className(baseName, extras = {});
Example usage
const classNames = require('html-classnames');
const isBig = true;
const isLong = false;
const names = classNames('some-class', {
'--is-big': isBig,
'--is-long': isLong,
});
console.log(names); // "some-class some-class--is-big"
How to install?
npm install html-classnames
or
yarn add html-classnames