quinn.io
quinn.io

Font Tool

$
go install go.quinn.io/ccf

Overview

The font tool downloads and installs Google Fonts, and generates CSS rules for the font face.

Usage

$ ccf fonts --help
Usage of ccf fonts:
  -config string
        Path to font configuration file (default "fonts.yaml")
  -debug
        Enable debug logging
  -gfonts-key string
        Google Fonts API key. (default "GFONTS_KEY" env var)

Defining Your Font Config

Create a file called fonts.yaml in the root of your project. It should look like this:

---
dir: ./example/fonts
stylesheet: ./example/css/fonts.css
import: ../fonts/
fonts:
  - family: Quicksand
    variants:
      - "regular"

Installing Fonts

Run the following command:

ccf fonts

This will download the specified fonts and generate CSS rules for them:

ls ./example/fonts/
Quicksand_regular.woff2
ls ./example/css/
fonts.css

The generated fonts.css will contain:

@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 300 700;
  src: url('../fonts/Quicksand_regular.woff2') format('woff2-variations');
}