@ekscss/cli

A simple, fast, and powerful CSS preprocessor

Usage no npm install needed!

<script type="module">
  import ekscssCli from 'https://cdn.skypack.dev/@ekscss/cli';
</script>

README

@ekscss/cli

Compile XCSS into CSS using ekscss on the command line or in package.json scripts.

Usage

NPM run globally

npx --package=@ekscss/cli -- xcss --help

Yarn run globally

yarn global add @ekscss/cli
xcss --help

Yarn run in project without install

Note: When in a yarn >= v2 project only

yarn dlx -p @ekscss/cli xcss --help

Yarn per project install

yarn add @ekscss/cli
yarn xcss --help

NPM per project install

npm -i @ekscss/cli
npx xcss --help

Output:

  Description
    Compile XCSS into CSS using ekscss

  Usage
    $ xcss [src] [dest] [options]

  Options
    -c, --config     Use specified config file
    -m, --map        Generate a source map  (default false)
    -q, --quiet      Don't print errors or stats
    -v, --version    Displays current version
    -h, --help       Displays this message

  Examples
    $ xcss styles.xcss dist/styles.css
    $ xcss --map styles.xcss
    $ xcss -q

Input and output paths

When src is not provided then automatically try index.xcss, src/index.xcss, or else error and exit.

When dest is not provided output CSS will be put into a file with the same file path as src but with a .css file extension.

Config files

XCSS configuration files may be in either JSON or JavaScript format. Config files will be discovered and used automatically if named appropriately and placed in your project directory. Config file resolution happens in order of:

  • any file path when you use the --config option
  • .xcssrc.cjs
  • .xcssrc.js
  • .xcssrc.json
  • xcss.config.cjs
  • xcss.config.js
  • xcss.config.json
  • an "xcss" field in your package.json

Notes

This package is intended to be simple and lightweight. If you need features like watching for file changes use rollup together with rollup-plugin-ekscss and @ekscss/rollup-plugin-css. Alternatively, for simple projects or when build speed is important, use esbuild with esbuild-plugin-ekscss.

This package registers the CLI executable binaries xcss and ekscss which are both equivalent.

Licence

ekscss is an MIT licensed open source project. See LICENCE.


© 2021 Max Milton