Getting started with CLI tool

The Cascadium CLI tool works with any type of project out-of-box.

Firstly, download latest Cascadium binaries from the official Github repository. Cascadium is available for Windows, Linux-based systems and Mac OS.

Cascadium does not have an official installer, so you need to put it in the environment path manually.

When running the utility without parameters, this is the list of parameters available in Cascadium:

                    Copyright (C) 2023 cascadium

                        -f, --file              Specifies a relative path to an input file.

                        -d, --dir               Specifies a relative path to recursively include an

                        -x, --extensions        Specify extensions (starting with dot) which the
                                                compiler will search for input directories.

                        -e, --exclude           Exclude an file or directory that matches the
                                                specified regex.

                        -o, --outfile           Specifies the output file where the compile CSS files
                                                will be written to.

                        -c, --config            Specifies the relative or absolute path to the
                                                configuration file.

                        --stdin                 Specifies that the stdin should be included as an

                        --p:Pretty              (Default: True) Specifies whether the compiler should
                                                generate an pretty, indented and formatted code.

                        --p:UseVarShortcut      (Default: True) Specifies whether the compiler should
                                                rewrite variable shortcuts.

                        --p:KeepNestingSpace    (Default: False) Specifies whether the compiler should
                                                keep spaces after the & operator.

                        --p:Merge               (Default: False) Specifies whether the compiler should
                                                merge rules and at-rules.

                        --watch                 Specifies if the compiler should watch for file
                                                changes and rebuild on each save.

                        --help                  Display this help screen.

                        --version               Display version information.

Explanation of each parameter:

  • -f, --file

    Specify an absolute or relative path to include an file in the compiler input.


                                :: input multiple files
                                cascadium -f my-file.xcss -f my-other-file.xcss -f ..\styles\file.xcss
                                :: input an absolute path to file
                                cascadium -f C:\Users\Adminstrator\Repo\styles\app.xcss
  • -d, --dir

    Specify an absolute or relative path to include an entire directory in the compiler input. This option includes all files in the indicated folder, recursively, including sub-directories.

    By default it will look for all files ending with .xcss, but you can specify more extensions with -x.


                                :: input directories
                                cascadium -d .\styles --dir .\js\vendor\styles
  • -x, --extensions

    Specify extensions to include when searching for files using `-d`.

    The extension .xcss is already included by default.


                                :: will search for all files terminating with
                                :: .css, .xcss and .scss in ./styles, recursively
                                cascadium -d .\styles -x .scss -x .css
  • -e, --exclude

    Specify regex patterns to exclude files from the compilation input. The provided regex is case-insensitive.

    The expression is applied to files only. If used with `-d`, it will perform the expression on the files obtained from the directory search.


                                cascadium -d . -e "node_modules"
  • -o, --outfile

    Specify the output CSS file location.

    For now, the compilation only generates a single merged output file for all input files.


                                cascadium -d .\styles -o .\dist\app.css
  • -c, --config

    Specify an configuration file.

    Configuration file is a structured way of calling Cascadium, eliminating the need to send all input parameters at once. To better understand the settings file, read the Options section.


                                cascadium -c .\cascadium.json
  • --stdin

    Reads the stdin input to the compiler output.


                                echo div { color: red; } | cascadium --stdin
  • --watch

    Runs Cascadium in the background and compiles whenever any of the input files change or a new file is created or removed.


                                cascadium -d .\styles --watch

For the parameters starting with --p:*, indicates that it is a compiler setting and they are explained here.