Skip to content

CLI improvements

Choose a tag to compare

@tivac tivac released this 27 Jul 19:39
· 1195 commits to main since this release

The CLI has long been an after-thought, but after running into a few places where an actual CLI or even CLI-style functionality would be useful it's time for a revamp.

The CLI has been completely rewritten, now w/ actual support for --help and other useful things you'd expect from a CLI.

usage: modular-css [options] <glob>...

options:
    -d, --dir DIR       Directory to search from [process cwd]
    -o, --out FILE      File to write output CSS to [stdout]
    -j, --json FILE     File to write output compositions JSON to
    -m, --map           Include inline source map in output
    --help              Show this help

So as an example, here's how you'd shove together all the .css files in a directory while ignoring everything in node_modules folders, and then outputting the CSS and JSON to files.

> modular-css -o ./out.css -j ./out.json **/*.css !**/node_modules/**

or use the CLI-style functionality from JS

var glob = require("modular-css/glob");

glob({
    dir    : "/some/dir",
    search : [ "**/*.css", "!**/node_modules/**" ]
});

This release also includes an update to postcss@5.1.0 which required some flopping around but should improve a few things.