A simple CLI wrapper for the CSS Inliner package.

Usage no npm install needed!

<script type="module">
  import cssInlinerCli from 'https://cdn.skypack.dev/css-inliner-cli';


CSS Inliner CLI

A simple CLI wrapper for the CSS Inliner package.


npm install css-inliner-cli


css-inliner --help
Usage: css-inliner-cli [options] <input>

  -V, --version                       output the version number
  -E, --extension <regex>             extension regex (default: "\\.([^.]+)quot;)
  -R, --replacement <string>          extension replacement (default: ".css.$1")
  -T, --template <handlebars|jinja2>  templating language to use
  -e, --encoding <format>             encoding of the input file (default: "utf-8")
  -d, --debug                         toggle debugging information
  -h, --help                          display help for command

The aim of this package is to be as compact and simple as possible. Some assumptions are therefore made regarding its use case. Most importantly, it is required that one or more files are selected using a glob pattern. Each match should be a file in order to be inlined.

For convenience, any pattern within each matched files can be replaced by some string. In the default configuration, the specified input <filename>.<ext> is inlined with any referenced CSS stylesheets. The result is written to <filename>.css.<ext>.


Make sure that you put the input argument in quotes to ensure that the shell does not run away with your magic variables, such as the wildcard *.

When using the --replacement or -R option, make sure to prepend any back references to capture groups in the extension regex with a backslash.