@m31271n/class-name
v0.1.0
Published
Convert virtual class into pratical class.
Downloads
2
Readme
class-name
Convert virtual class into pratical class.
Install
$ npm install @m31271n/class-name
Usage
const makeCN = require('@m31271n/class-name');
const classMapping = {
'-virtual-class-a': 'bold nowrap right-align',
// One virtual class can reference another virtual class
'-virtual-class-b': 'border-right m1 -virtual-class-a',
'-virtual-class-c': 'px2',
};
const cn = makeCN(classMapping);
cn('-virtual-class-a'); // '-virtual-class-a bold nowrap right-align'
API
makeCN(classMapping)
classMapping
: Object
Returns cn(...args)
.
cn(...args)
Same API with classnames. The only difference is that cn(...args)
returns class list contains virtual class.