1.0.0 • Published 9 years ago

classnameify v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

classnameify

Build status NPM version js-xo-style

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 classnameify

Usage

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)

NameTypeDescription
valObject|ArrayThe CSS components to classnameify

Returns: Object.

License

MIT © Joakim Carlstein