html-classnames

1.0.0 • Public • Published

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

Changelog

This repository is using semantic-release, so you can find nice changeglog in the CHANGELOG file.

Contributing

All contributions welcome. Feel free to start new issue or even create a PR right away!

Readme

Keywords

none

Package Sidebar

Install

npm i html-classnames

Weekly Downloads

25

Version

1.0.0

License

MIT

Unpacked Size

3.62 kB

Total Files

6

Last publish

Collaborators

  • sznowicki