Command-line interface

A quick and simple way to start using Hacss

Perhaps the easiest method to use Hacss is through its command-line interface. This short guide will help you to install the Hacss CLI and show you how to use it.


The command-line interface works well with any project and does not require any configuration or even a permanent installation. To try it out, you can start with npx:

echo "color:red;" | npx hacss

For better performance, you can install the @hacss/cli package, which provides the hacss command:

npm install -g @hacss/cli

The remainder of this guide assumes a permanent installation.


You can run the hacss command with no arguments at any time in order to see the available options described below.

hacss [--config <config-file>] [--output <output-file>] <sources>


[--config <config-file>]

When a --config argument is specified, the configuration file specified by the <config-file> path will be used. When not specified, hacss.config.js will be used if it exists. While it is not strictly necessary to have a configuration file, you may want to review the configuration guide to understand when you might want to use one.

[--output <output-file>]

When an --output argument is specified, the generated CSS output will be written to the <output-file> path. When not specified, the CSS output will be written to the standard output.


The globby pattern specified here will be used to search for source files containing CSS classes that should be included in the generated style sheet. You can also specify a series of glob patterns.


If you would like to extend the capabilities of Hacss as described here, you can pipe the output of Hacss to PostCSS. For example:

hacss src/**/*.jsx | postcss