Convert TTF files to WOFF2 ones.
npm install ttf2woff2-no-gyp[//]: # ( )
[//]: # (This file is automatically generated by a metapak)
[//]: # (module. Do not change it except between the)
[//]: # (content:start/end flags, your changes would)
[//]: # (be overridden.)
[//]: # ( )






[//]: # (::contents:start)
This is a NodeJS wrapper for the Google WOFF2
project. If the C++ wrapper compilation fail, it
fallbacks to an Emscripten build.
Install ttf2woff2 globally, then:
``sh`
cat font.ttf | ttf2woff2 > font.woff2
On Windows without cat, use (in PowerShell):`pwsh`
Start-Process -NoNewWindow -Wait ttf2woff2.cmd -RedirectStandardInput font.ttf -RedirectStandardOutput font.woff2OR
start-process -nnw -wait ttf2woff2.cmd -rsi font.ttf -rso font.woff2
`js
var fs = require('fs');
var ttf2woff2 = require('ttf2woff2');
var input = fs.readFileSync('font.ttf');
fs.writeFileSync('font.woff2', ttf2woff2(input));
``
Feel free to push your code if you agree with publishing under the MIT license.
[//]: # (::contents:end)