# atomizer

> A tool for creating Atomic CSS, a collection of single purpose styling units for maximum reuse

Latest version **3.30.0** (published 2024-10-02) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install atomizer
pnpm add atomizer
yarn add atomizer
bun add atomizer
```

Provides the command `atomizer`.

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 3.30.0 |
| Published | 2024-10-02 |
| First published | 2015-02-12 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.0 |
| Dependencies | 7 |
| Unpacked size | 182 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1544 |
| Maintainers | pankajparashar, snyamathi, redonkulus, renatoi, src-code |
| Keywords | atomic, atomize, atomizer, atomizr, css |

## Links

- npm: https://www.npmjs.com/package/atomizer
- Repository: https://github.com/acss-io/atomizer
- Issues: https://github.com/acss-io/atomizer/issues
- npm.io page: https://npm.io/package/atomizer

## Dependencies (7)

- [glob](https://npm.io/package/glob.md) ^10.3.12
- [chalk](https://npm.io/package/chalk.md) ^4.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [xregexp](https://npm.io/package/xregexp.md) ^5.1.0
- [chokidar](https://npm.io/package/chokidar.md) ^3.5.3
- [commander](https://npm.io/package/commander.md) ^11.1.0
- [minimatch](https://npm.io/package/minimatch.md) ^9.0.4

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 3.30.0 (latest) — 2024-10-02
- 3.29.0 — 2024-05-19
- 3.28.0 — 2023-06-18
- 3.27.0 — 2023-04-11
- 3.26.0 — 2023-04-01
- 3.25.0 — 2023-01-22
- 3.24.2 — 2022-12-22
- 3.24.1 — 2022-12-09
- 3.24.0 — 2022-12-06
- 3.23.0 — 2022-12-01
- 3.22.0 — 2022-11-23
- 3.21.2 — 2022-09-09
- 3.21.1 — 2022-09-09
- 3.21.0 — 2022-09-07
- 3.20.0 — 2022-08-25
- … 94 more at https://npm.io/package/atomizer/versions

## README

# Atomizer

[![npm version](https://badge.fury.io/js/atomizer.svg)](http://badge.fury.io/js/atomizer)

## TL;DR

![GIF showing the VSCode extension (with autocompletion)](http://res.cloudinary.com/dw9fem4ki/image/upload/v1459669466/usage_mtx65l.gif)

## Overview

Atomizer is a tool that helps you create simple, scalable, CSS rules ([acss.io](http://acss.io)).

For more information we recommend that you read "[Challenging CSS best practices](http://www.smashingmagazine.com/2013/10/21/challenging-css-best-practices-atomic-approach/)", watch the Atomic CSS [presentation](https://www.youtube.com/watch?v=ojj_-6Xiud4), or [check this deck](https://www.haikudeck.com/atomic-css-science-and-technology-presentation-dJ0xlFjhBQ).

## Install

```bash
npm install atomizer -g
```

## Usage

### CLI

```bash
Usage: atomizer [options] [path]

  Options:

    -h, --help                          output usage information
    -V, --version                       output the version number
    -R, --recursive                     process all files recursively in the path.
    -c, --config=[file]                 source config file if any.
    -r, --rules=[file]                  custom rules file (argument may be passed multiple times)
    -o, --outfile=[file]                destination config file.
    -n, --namespace=[namespace]         adds the given namespace to all generated Atomic CSS selectors.
    -H, --helpersNamespace=[namespace]  adds the given namespace to all helper selectors.
    -w, --watch=[target]                rebuilds when changes are detected in the file, directory, or glob (argument may be passed multiple times and is parsed for Atomic CSS classes)

    --rtl                               swaps `start` and `end` keyword replacements with `right` and `left`.
    --exclude=[pattern]                 pattern to exclude file to be scanned
    --bump-mq                           increases specificity of media queries a small amount
    --strict                            bail if missing configs such as breakpoints.
    --verbose                           show additional log info (warnings).
```

Example:

```bash
atomizer -o atomic.css ./site/*.html
atomizer -o atomic.css ./site/*.html --exclude=*-0.html
atomizer -c config.js -R ./site/ > atomic.css
atomizer -c config.js -n \#myrootclass > atomic.css
```

### API

```javascript
import Atomizer from 'atomizer';

const defaultConfig = {
    breakPoints: {
        sm: '@media(min-width:750px)',
        md: '@media(min-width:1000px)',
        lg: '@media(min-width:1200px)'
    },
    custom: {
        border: '2px dotted #f00'
    }
};

const atomizer = new Atomizer({verbose: true});

// Parse text to find Atomic CSS classes
const foundClasses = atomizer.findClassNames('<div class="P(10px) M(20%) Bd(border)--sm"></div>');

// Generate Atomizer configuration from an array of Atomic classnames
const finalConfig = atomizer.getConfig(foundClasses, defaultConfig);

// Generate Atomic CSS from configuration
const css = atomizer.getCss(finalConfig);
```

## License

This software is free to use under the Yahoo Inc. BSD license. See the [LICENSE file][] for license text and copyright information.

[license file]: https://github.com/acss-io/atomizer/blob/main/LICENSE.md

Third-party open source code used are listed in our [package.json file](https://github.com/acss-io/atomizer/blob/main/package.json).

---
_Source: https://npm.io/package/atomizer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
