atomizer
TypeScript icon, indicating that this package has built-in type declarations

3.30.0 • Public • Published

Atomizer

npm version

TL;DR

GIF showing the VSCode extension (with autocompletion)

Overview

Atomizer is a tool that helps you create simple, scalable, CSS rules (acss.io).

For more information we recommend that you read "Challenging CSS best practices", watch the Atomic CSS presentation, or check this deck.

Install

npm install atomizer -g

Usage

CLI

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:

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

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.

Third-party open source code used are listed in our package.json file.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
3.30.0232latest

Version History

VersionDownloads (Last 7 Days)Published
3.30.0232
3.29.034
3.28.029
3.27.05
3.26.05
3.25.07
3.24.22,756
3.24.15
3.24.05
3.23.05
3.22.05
3.21.20
3.21.10
3.21.00
3.20.00
3.19.00
3.18.20
3.18.11
3.18.00
3.17.00
3.16.20
3.16.10
3.16.00
3.15.00
3.14.10
3.14.00
3.13.00
3.12.00
3.11.03
3.10.02
3.9.26
3.9.138
3.9.00
3.8.00
3.7.33
3.7.20
3.7.10
3.7.0135
3.6.30
3.6.299
3.6.10
3.6.00
3.5.330
3.5.26
3.5.10
3.5.0167
3.4.90
3.4.80
3.4.70
3.4.617
3.4.50
3.4.41
3.4.30
3.4.20
3.4.10
3.4.00
3.3.120
3.3.110
3.3.100
3.3.80
3.3.70
3.3.60
3.3.50
3.3.40
3.3.30
3.3.20
3.3.10
3.3.00
3.2.10
3.2.00
3.1.30
3.1.21
3.1.10
3.1.00
3.0.60
3.0.50
3.0.40
3.0.30
3.0.20
3.0.10
3.0.00
3.0.0-alpha.70
3.0.0-alpha.60
3.0.0-alpha.50
3.0.0-alpha.40
3.0.0-alpha.30
3.0.0-alpha.20
3.0.0-alpha.10
2.0.0-beta.100
2.0.0-beta.90
2.0.0-beta.80
2.0.0-beta.70
2.0.0-beta.60
2.0.0-beta.50
2.0.0-beta.40
2.0.0-beta.31
2.0.0-beta.20
2.0.0-beta.10
2.0.0-alpha.30
2.0.0-alpha.20
2.0.0-alpha.10
1.0.00
1.0.0-alpha.10
0.2.54
0.2.40
0.2.30
0.2.20
0.2.10
0.2.00

Package Sidebar

Install

npm i atomizer

Weekly Downloads

3,602

Version

3.30.0

License

BSD-3-Clause

Unpacked Size

186 kB

Total Files

16

Last publish

Collaborators

  • pankajparashar
  • snyamathi
  • redonkulus
  • renatoi
  • src-code