How to set up your project and use the Sfumato CLI tool.
Sfumato works by reading one or more source CSS files and generating output CSS files that your project should actually use for styling. Typically the source file is named source.css but can be any valid CSS file name.
The source CSS file contains:
Sfumato configuration settings, like watch paths
Customizations, like colors, static utilities, and variants (optional)
Your own custom CSS (optional)
A typical folder structure would place the source stylesheet alongside the generated one, as in the example below. But the source can be anywhere in your project, and the generated CSS file location can be anywhere relative to the source CSS file location.
Sfumato can create a sample CSS file for you. In a terminal, navigate to the folder where you want the file created, and run the init command. This will create a reference file named sfumato-example.css with all the configuration options and examples for custom colors, variants, etc.
Note: you should rename the sfumato-example.css file to something like source.css
before making any changes.
Once you have the example CSS file in place and renamed to your liking, customize the settings to match your project requirements. The example file is commented to guide you in tailoring it for your project needs.
Keep in mind that you may not even need any custom CSS if you style everything with utility classes.
PRO TIP: Settings not marked "REQUIRED" should be deleted if you're not changing their values. Settings marked "EXAMPLE" are just examples that should also be deleted.
PRO TIP: Only configure project paths with files that will use Sfumato classes, like folders with HTML files, JavaScript files that will change element classes, etc. Use the exclusion options when appropriate. Don't scan folders unnecessarily!
Once you've configured your source CSS file and removed optional and example code, it may look a little more like this:
Once you have a source file established, you can try using the tool to watch project files for changes and build the output CSS file!
The syntax for running the Sfumato CLI tool is:
The commands are:
help
Get help on commands and usage
init
Create an example source CSS file named sfumato-example.css in the current path
build
Build the specified file(s) and exit
watch
Build the specified file(s) and watch for changes, rebuilding as necessary
You can append additional css file paths and minify flags to have Sfumato watch and build all of them.