foliojs / fontkit

An advanced font engine for Node and the browser
1.44k stars 210 forks source link

Missing instructions on how to build fontkit for brwoser #302

Closed Typogram closed 10 months ago

Typogram commented 1 year ago

@devongovett thanks for providing a working codepen on https://github.com/foliojs/fontkit/issues/77 Could you provide instruction on how to build fontkit.bundle.js for browser? In the codepen, you import from this link:

/* esm.sh - fontkit@2.0.2 */
export * from "https://esm.sh/v106/fontkit@2.0.2/es2022/fontkit.bundle.js";

Ideally, after run npm run build, the dist folder should include a fontkit.bundle.js ready for browser usage.

Lorp commented 11 months ago

I made a minimal repo, fontkit-tiny, to demonstrate building Fontkit for the browser:

https://github.com/Lorp/fontkit-tiny

rsms commented 10 months ago

Here's a bash script that builds a bundled, minified single-file ES module that can be used in modern browsers: https://gist.github.com/rsms/c806aebbf97240f052b8157d0a69e9c6