classnameify

1.0.0 • Public • Published

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)

Name Type Description
val Object|Array The CSS components to classnameify

Returns: Object.

License

MIT © Joakim Carlstein

Package Sidebar

Install

npm i classnameify

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • joakimbeng