@gorebel/css-class-generator

2.0.0 • Public • Published

css-class-generator

Generates a sequential, valid CSS class, generating the next smallest class names possible.

npm install --save css-class-generator

API

cssNameGenerator(prefix = '') -> iterator

Will throw if prefix is not a valid class name (unless the prefix is -). The exception will be thrown when the first value is being yielded.

Class names are generated without a leading ..

It uses generators, so you'll have to be using a version of node that supports this.

Example

const cssNameGenerator = require('css-class-generator');
for (let value of cssNameGenerator()) {
  // 'A', 'B', ...
}
for (let value of cssNameGenerator('-')) {
  // '-A', '-B', ...
}
for (let value of cssNameGenerator('custom-namespace-')) {
  // You get the idea...
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    8
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    8

Package Sidebar

Install

npm i @gorebel/css-class-generator

Weekly Downloads

8

Version

2.0.0

License

ISC

Unpacked Size

6.55 kB

Total Files

9

Last publish

Collaborators

  • sakai135
  • djacobi21
  • devinus
  • datajohnny
  • selby
  • kevindutra
  • rup1
  • m_j_robbins
  • theotherstevenc