Skip to content

CLI Usage

Installation

sh
cargo install webfont-generator --features cli

TIP

The cli feature is opt-in and not included in the default feature set. This avoids pulling in clap for library users.

Usage

sh
webfont-generator [OPTIONS] --dest <DEST> <FILES>...

<FILES> accepts individual SVG file paths or directories. When a directory is given, all .svg files inside it are included (non-recursive, sorted alphabetically).

Examples

Generate default formats (EOT, WOFF, WOFF2) from a directory:

sh
webfont-generator --dest ./dist/fonts ./icons/

Custom font name and specific types:

sh
webfont-generator --dest ./dist/fonts --font-name my-icons --types woff2,woff ./icons/

Generate with an HTML preview page:

sh
webfont-generator --dest ./dist/fonts --html ./icons/

Dry run (no files written to disk):

sh
webfont-generator --dest ./dist/fonts --no-write ./icons/

Custom start codepoint in hex:

sh
webfont-generator --dest ./dist/fonts --start-codepoint 0xE000 ./icons/

Options reference

Positional arguments

ArgumentDescription
<FILES>...SVG files or directories containing SVG files (required)

Required options

FlagDescription
-d, --dest <DEST>Output directory

Font options

FlagDefaultDescription
-n, --font-name <NAME>iconfontFont family name
-t, --types <TYPES>eot,woff,woff2Comma-separated font types to generate
--font-height <N>--Explicit font height
--ascent <N>--Font ascent value
--descent <N>--Font descent value
--start-codepoint <HEX>0xF101Starting codepoint for auto-assigned glyphs

Output control

FlagDefaultDescription
--css / --no-css--cssGenerate or skip CSS output
--html / --no-html--no-htmlGenerate or skip HTML preview
--write / --no-write--writeWrite files to disk or dry run
--ligature / --no-ligature--ligatureEnable or disable ligature support

Template options

FlagDescription
--css-template <PATH>Custom Handlebars CSS template
--html-template <PATH>Custom Handlebars HTML template
--css-fonts-url <URL>URL prefix for fonts in CSS

Meta

FlagDescription
-h, --helpPrint help
-V, --versionPrint version

See also

Released under the MIT License.