node package manager
Orgs are free. Discover, share, and reuse code in your team. Create a free org »

inject-typekit-script-stream

inject-typekit-script-stream

NPM version build status Test coverage Downloads js-standard-style

Streamingly inject a Typekit kit script into html. This should probably only be done when prototyping, as the script itself is a non-negligable 0.3MB, where your typical font only weighs 0.01MB.

Installation

$ npm install inject-typekit-script-stream

Usage

const tk = require('inject-typekit-script-stream')
const filed = require('filed')
const http = require('http')
 
http.createServer((req, res) => {
  filed(__dirname + '/index.html')
    .pipe(tk({ kitId: 'ehq9vim' }))
    .pipe(res)
})

API

tk(opts)

Create a duplex inject stream. Expects a <body> tag to be present. The following opts are available:

  • kitId: The unique id for your Typekit font kit. You can find this under kits -> <select kit> -> embed code.

See Also

License

MIT