Convert otf
, ttf
, eot
, svg
, woff
, or woff2
font files to CSS @font-face {}
declarations with embedded data as src: url()
(in Base64
).
Always:
npm i @sequencemedia/make-face
Logging is implemented with debug
and can be enabled with the @sequencemedia/make-face
namespace. This package will execute silently without that namespace enabled
node make-face -f ~/from/file/path -t ~/to/file/path
node read-face -f ~/from/file/path -t ~/to/file/path/file.css
DEBUG=@sequencemedia/make-face node make-face -f ~/from/file/path -t ~/to/file/path
DEBUG=@sequencemedia/make-face node read-face -f ~/from/file/path -t ~/to/file/path/file.css
Read font files from the file system and transform them to css
files.
import { makeFace } from 'make-face'
const fromDirectory = '~/origin/file/path'
const toDirectory = '~/destination/file/path'
makeFace(fromDirectory, toDirectory)
import debug from 'debug'
import { makeFace } from 'make-face'
debug.enable('@sequencemedia/make-face')
const fromDirectory = '~/origin/file/path'
const toDirectory = '~/destination/file/path'
makeFace(fromDirectory, toDirectory)
Read css
files from the file system and concatenate them to another css
file.
import { readFace } from 'make-face'
const fromDirectory = '~/src/file/path'
const toFile = '~/destination/file/path/file.css'
readFace(fromDirectory, toFile)
import debug from 'debug'
import { readFace } from 'make-face'
debug.enable('@sequencemedia/make-face')
const fromDirectory = '~/src/file/path'
const toFile = '~/destination/file/path/file.css'
readFace(fromDirectory, toFile)