1.0.8 • Published 3 years ago

dirty-calf v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Dirty Calf

I'm a super dirty calf and my job is to poop short CSS classes for you project.

I can reduce your CSS bundle size by 40-70%.

Use me with postcss modules.

Example

// Turn these ugly classes
"navbar" "navbar__link" "footer" "btn-closed" "my-wife"

// Into a beautiful alphabet
"a" "b" "c" "d" "e" ... "aa" "ab" "ac" ... "xyz" "xzz" ...

Don't use me in small projects, it will not make much difference. The bigger CSS file, the bigger percentage.

Installation

npm i -D dirty-calf

Config

A Super-duper simple config. You can always extend my alphabet and add some sort of prefixes and suffixes.

{
  alphabet: string; // All characters that will be used, default: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_",

  formatting: {
      prefix: string, // Prepend a string to all classnames, default: ""
      suffix: string, // Append a string to all classnames, default: ""
      digitPrefix: string, // Prepend a string to all classnames that start with a digit, otherwise they're invalid. default: "_".
  },
}

Usage

Put my poop method in the postcss modules generate scooped names property and that's it.

// Give me birth and config me
const dirtyCalf = new DirtyCalf(config);

// Postcss modules config
...
   // My poop method goes here (important to bind it)
  generateScopedName: dirtyCalf.poop.bind(dirtyCalf)
...

License

MIT

Ideas

The issues section is open for you. Improve me with any ideas you have

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago