Giter VIP home page Giter VIP logo

atomizer's Introduction

Atomizer

Join the chat at https://gitter.im/yahoo/atomizer

npm version Build Status Dependency Status devDependency Status Coverage Status

Overview

Atomizer is a tool that helps you create Atomic CSS rules (acss.io).

Atomic CSS is a collection of single purpose styling units for maximum reuse that fits well with components in templated frameworks such as React, Ember or Angular. 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.
    --rtl                               swaps `start` and `end` keyword replacements with `right` and `left`.
    --ie                                adds old IE hacks to the output.
    --verbose                           show additional log info (warnings).

Example:

atomizer -o atomic.css ./site/*.html
atomizer -c config.js -R ./site/ > atomic.css
atomizer -c config.js -n \#myrootclass > atomic.css

API

var Atomizer = require('atomizer');

var defaultConfig = {
    "breakPoints": {
        'sm': '@media(min-width=750px)',
        'md': '@media(min-width=1000px)',
        'lg': '@media(min-width=1200px)'
    },
    "custom": {
        "1": "1px solid #000",
        "foo": "2px dotted #f00"
    },
    "classNames": [
        'Bd(1)',
        'Bd(foo)',
        'Bd(foo)--sm',
        'Bd(foo)--md',
        'D(n)!'
    ]
};

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

// Parse text to find Atomic CSS classes
var foundClasses = atomizer.findClassNames('<div class="D(n)! P(10px) M(20%) Bd(1) Bd(foo)--sm"></div>');

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

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

Plugins

Developer docs

We have wiki docs for contributors who want to help with the maintenance and development of this tool.

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.

atomizer's People

Contributors

davidfmiller avatar dylanharrington avatar gitter-badger avatar lalau avatar redonkulus avatar renatoi avatar roderickhsiao avatar src-code avatar thierryk avatar vijar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.