css-mixer
v0.2.2
Published
Minimal CSS class & id joiner written in TypeScript.
Downloads
2
Maintainers
Readme
css-mixer
Minimal 226 bytes
CSS class & id joiner written in TypeScript.
Inspired by clsx & classnames.
Installation
npm i css-mixer
Usage
JSX
Code:
import mixer from 'css-mixer';
//...
const isCapibara = true;
const isPokemon = false;
return <div
id={isCapibara && 'capibara', isPokemon && 'pokemon'}
className={mixer('foo', {bar: true, pub: false}, ['fizz', 'buzz'])}
/>;
//...
Outcome (html):
<div id="capibara" class="foo bar fizz buzz"></div>
JS
const mixer = require('css-mixer');
console.log(
mixer('a', true && 'b', false && 'c', ['d', 'e'], {f: true, g: false})
);
// output: 'a b d e f'