Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/manovotny/chance-class-name

A Chance.js mixin to generate class names.
https://github.com/manovotny/chance-class-name

chance chancejs class classname mixin name

Last synced: 1 day ago
JSON representation

A Chance.js mixin to generate class names.

Awesome Lists containing this project

README

        

# chance-class-name [![Build Status](https://travis-ci.org/manovotny/chance-class-name.svg?branch=master)](https://travis-ci.org/manovotny/chance-class-name)

> A [Chance.js mixin](http://chancejs.com/#mixin) to generate class names.

Class names are generated according the [W3C CSS spec](https://stackoverflow.com/a/449000).

## Install

### NPM

```
$ npm i chance-class-name
```

### Yarn

```
$ yarn add chance-class-name
```

## Usage

```js
import Chance from 'chance';
import className from 'chance-class-name';

const chance = new Chance();

chance.mixin({
className
});

chance.className();
```

By default, `chance-class-name` will return a randomly generated class name.

Class names will be between 1 and 25 characters long.

Example: `M-oYLdbPVMpbhjGrsLH`

## License

MIT © [Michael Novotny](http://manovotny.com)