1.0.0 • Published 8 years ago

insert-fonts v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

insert-fonts Build Status

Insert a set of fonts using base64 encoding and CSS font-face tags

Install

$ npm install --save insert-fonts

Usage

var insertFonts = require('insert-fonts')

insertFonts({
  'Awesome Font Face': {
    400: '...' // base 64 encoded font data for the 400 weight
    500: '...' // base 64 encoded font data for the 500 weight
  },
  'Other Great Face': {
    400: '...'
  }
})
//=> creates fonts and inserts @font-face tags into the dom

API

insertFonts(fonts) -> string

Returns the inserted CSS string.

fonts

Required
Type: object

An object where the keys/values represent font face names and their weights, respectively. The weights are also objects, where the keys/values represent the weight and the font data (base 64 encoded), respectively.

License

MIT © Ben Drucker