1.0.0 • Published 10 years ago
classnameify v1.0.0
classnameify
Generate classname selectors for CSS components, works splendid together with e.g. React
Why?
Generating classnames according to the contents of CSS declarations solves the biggest problem with large scale CSS, i.e. the fact that it cascades. See unistyle for how to use this in a scalable way.
Installation
Install classnameify using npm:
npm install --save classnameifyUsage
Module usage
var classnameify = require('classnameify');
classnameify({
myComponent: {
color: '#FFF',
fontSize: '10px'
}
});
/*
{
'._e80a8a8': {
color: '#FFF',
fontSize: '10px'
}
}
*/Usage together with e.g. React
Have a look at unistyle for how this fits together with React.
API
classnameify(val)
| Name | Type | Description |
|---|---|---|
| val | Object|Array | The CSS components to classnameify |
Returns: Object.
License
MIT © Joakim Carlstein
1.0.0
10 years ago