Convert font files into CSS @font-face declarations with embedded Base64 data

Usage no npm install needed!

<script type="module">
  import sequencemediaMakeFace from 'https://cdn.skypack.dev/@sequencemedia/make-face';


Make Face

Convert otf, ttf, eot, svg, woff, or woff2 font files to CSS @font-face {} declarations with embedded data as src: url() (in Base64).


npm i @sequencemedia/make-face

Run from the command line

node make-face -f ~/from/file/path -t ~/to/file/path
node read-face -f ~/from/file/path -t ~/to/file/path/file.css

Make Face

Read font files from the file system and transform them to css files.

Import using JS

var makeFace = require('make-face').makeFace;

var fromDirectory = '~/origin/file/path';
var toDirectory = '~/css/file/path';

makeFace(fromDirectory, toDirectory);

Import using ES

import { makeFace } from 'make-face'

const fromDirectory = '~/origin/file/path'
const toDirectory = '~/destination/file/path'

makeFace(fromDirectory, toDirectory)

Read Face

Read css files from the file system and concatenate them to another css file.

Using JS

var readFace = require('make-face').readFace;

var fromDirectory = '~/origin/file/path';
var toFile = '~/destination/file/path/file.css';

readFace(fromDirectory, toFile);

Using ES

import { readFace } from 'make-face'

const fromDirectory = '~/src/file/path'
const toFile = '~/destination/file/path/file.css'

readFace(fromDirectory, toFile)