Atomizer is a tool that helps you create Atomic CSS rules.
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" or watch the Atomic CSS presentation.
npm install atomizer -g
atomizer [-c|--config=<file>] [-o|--outfile=<file>] [-n namespace] [--rtl] [--help] [--verbose] [ [-R] files_to_parse ...]
Example:
atomizer -o atomic.css ./site/*.html
atomizer -c config.js -R ./site/ > atomic.css
atomizer -c config.js -n \#myrootclass > atomic.css
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);
We have wiki docs for contributors who want to help with the maintenance and development of this tool.
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.