• Stars
    star
    2,603
  • Rank 16,984 (Top 0.4 %)
  • Language
    CSS
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

NPM packages for Open Source typefaces

The Typefaces project is now deprecated.

@DecliningLotus created FontSource which provides the same functionality as Typefaces but with automated releases & richer support for importing specific weights, styles, or language subsets.

To start using Fontsource, replace in your package.json any instances of "typeface-" with "fontsource-".

Then change imports from e.g. "import 'typeface-roboto'" to "import 'fontsource-roboto/latin.css'".

Typeface packages will continue working indefinitely so no immediate changes are necessary.

Typefaces

NPM packages for Open Source typefaces — making it easier to self-host webfonts.

https://www.bricolage.io/typefaces-easiest-way-to-self-host-fonts/

Why

  • Self-hosting is significantly faster. Loading a typeface from Google Fonts or other hosted font service adds an extra (blocking) network request. In my testing, I’ve found replacing Google Fonts with a self-hosted font can improve a site’s speedindex by ~300 miliseconds on desktop and 1+ seconds on 3g. This is a big deal.
  • Your fonts load offline. It’s annoying to start working on a web project on the train or airplane and see your interface screwed up because you can’t access Google fonts. I remember once being in this situation and doing everything possible to avoid reloading a project as I knew I’d lose the fonts and be forced to stop working.
  • Go beyond Google Fonts. Some of my favorite typefaces aren’t on Google Fonts like Clear Sans, Cooper Hewitt, and Aleo.
  • All web(site|app) dependencies should be managed through NPM whenever possible. Tis the modern way.

What

Each typeface package ships with all the necessary font files and css to self-host an open source typeface.

All Google Fonts have been added as well as a small but growing list of other open source fonts. Open an issue if you want a font added!

How

Couldn’t be easier. This is how you’d add Open Sans.

npm install --save typeface-open-sans

Then in your app or site’s entry file.

require("typeface-open-sans")

And that’s it! You’re now self-hosting Open Sans!

It should take < 5 minutes to swap out Google Fonts.

Typeface assumes you’re using webpack with loaders setup for loading css and font files (you can use Typeface with other setups but webpack makes things really really simple). Assuming your webpack configuration is setup correctly you then just need to require the typeface in the entry file for your project.

Many tools built with webpack such as Gatsby and Create React App are already setup to work with Typefaces. Gatsby by default also embeds your CSS in your <head> for even faster loading.

If you’re not using webpack or equivalent tool that allows you to require css, then you’ll need to manually integrate the index.css and font files from the package into your build system.

Alternatives without Webpack

Adding other fonts

The easiest way to find out if your favorite typeface is supported is by searching on NPM or in the packages directory in this repo.

I’d love to see every open source font on NPM! Open an issue if a favorite typeface of yours is missing. I’ve programmatically published all fonts from Google Fonts and am planning on doing the same with fonts hosted on FontSquirrel through their API.

Other ideas to explore

  • Add subsetted version of every font.
  • Initially I’ve just added support for the Latin version of fonts. Would love to hear ideas for how to support other languages. Perhaps additional css files e.g. require('open-sans/greek.css')?
  • Ship fallback css helpers — figuring out your fallback css isn’t particularly easy. Perhaps there’s a way to automate this. E.g. if you’re using typeface X at fontsize Y with fallback font Z, here’s a function to generate the fallback css.
  • Explore futher optimizations for loading fonts. https://www.zachleat.com/web/comprehensive-webfonts/ has a long list. Most require painful per-project scripting. What if the best strategies could be automated?

More Repositories

1

typography.js

A powerful toolkit for building websites with beautiful design
JavaScript
3,802
star
2

react-headroom

Hide your header until you need it
JavaScript
1,817
star
3

react-spinkit

A collection of loading indicators animated with CSS for React
CSS
1,491
star
4

docker-nginx

Nginx Docker image for easy hosting of static sites
Nginx
337
star
5

react-gravatar

React component for rendering a gravatar profile image
JavaScript
278
star
6

coffee-react-quickstart

Quickstart for building React single page apps using Coffeescript, Gulp, Webpack, and React-Router
CoffeeScript
254
star
7

superagent-bluebird-promise

Add promise support to superagent using Bluebird
CoffeeScript
183
star
8

element-resize-event

Library to make it easy to listen for element resize events
JavaScript
176
star
9

react-sparkline

React component for rendering simple sparklines
CoffeeScript
147
star
10

blog

my blog!
JavaScript
124
star
11

react-markdown-textarea

Component for React to create textareas for entering Markdown with built-in preview inspired by Github's design
CoffeeScript
120
star
12

react-micro-bar-chart

React component for micro bar-charts rendered with D3
CoffeeScript
112
star
13

trpc-crdt

tRPC integrations for CRDTs: CRDT-native RPC calls
TypeScript
110
star
14

react-retina-image

React component for serving high-resolution images to devices with retina displays
CoffeeScript
109
star
15

facebook-export

Tools to help administer your Facebook groups
CoffeeScript
100
star
16

react-responsive-grid

Power tools for building responsive layouts with React
CoffeeScript
91
star
17

react-component-gallery

React component for creating an evenly spaced gallery of children components
CoffeeScript
88
star
18

react-icon-factory

Simply add icon SVGs and the react icon factory will manufacture a custom icon component!
JavaScript
66
star
19

cjsx-loader

coffee-react-transform loader module for webpack
Makefile
53
star
20

react-smart-time-ago

Show relative "time ago" dates for anything in last two weeks and absolute dates from then on back
JavaScript
33
star
21

react-component-width-mixin

React mixin which sets width as state variable and updates as component changes shape
JavaScript
29
star
22

react-simple-table

For when you just want a table
CoffeeScript
23
star
23

isRetina

Simple function which determines if your code is running on a high DPR device or not
JavaScript
23
star
24

gatsby-starter-theme-ui

Fork of the Gatsby default starter but with theme-ui
JavaScript
19
star
25

react-autoupdate-time

Renders a <time> element that autoupdates at a configurable interval
CoffeeScript
19
star
26

og_mailinglist

Drupal Module that converts individual Organic Groups into mailing lists.
PHP
18
star
27

compass-vertical-rhythm

A port-in-progress of the Compass vertical rhythm library
CoffeeScript
18
star
28

check-gatsby-caching

Checks if your Gatsby site's cache-control headers are correct and optimized
JavaScript
18
star
29

Fuzzymatcher.js

Fuzzymatching library optimized for powering auto-complete widgets
JavaScript
18
star
30

docker-nginx-reverse-proxy-ssl

Docker image for creating simple reverse proxy with ssl termination
Shell
17
star
31

linux-config

my personal config files
Vim Script
16
star
32

color-pairs-picker

Given a color, it picks pleasing and well contrasted background and foreground colors
CoffeeScript
14
star
33

react-page-width

React mixin so a component can always know the current page width
CoffeeScript
13
star
34

Eduglu-Chatroom

Awesome Drupal-groups aware Chatroom built on Node.js
JavaScript
12
star
35

toml-loader

TOML loader module for webpack
JavaScript
11
star
36

makersgtd

Yet Another GTD Single Page App
CoffeeScript
10
star
37

engagement

Track when a user is engaging with a page
CoffeeScript
9
star
38

docker-nodejs-base

Base for building node.js web apps. Node.js, Ruby, Bundler, etc.
9
star
39

hapi-rethinkdb-thinky

Hapi plugin that automatically loads your Thinky models for RethinkDB
CoffeeScript
9
star
40

modularscale

Calculate a modular scale
CoffeeScript
9
star
41

aiocalendar

All-in-one calendar feature built in Drupal
JavaScript
8
star
42

image-exists

Check if an image exists
JavaScript
8
star
43

gray-percentage

Convenience function to get a gray value by percentage e.g. gray(60) -> "hsl(0,0%,60%)"
CoffeeScript
8
star
44

react-component-starter

Quickstart for creating a Coffeescript React component with examples
JavaScript
8
star
45

phpmailer

a temporary (hopefully) fork of PHPMailer to work on some changes we need for OG Mailinglist. The issue for our changes can be found at http://sourceforge.net/tracker/?func=detail&aid=3080711&group_id=26031&atid=385707
PHP
7
star
46

react-ghost-button

A simple react-ghost-button
CoffeeScript
7
star
47

gatsby-starter-building-blog

Gatsby v2 starter with colors taken from a photo of a building in Berkeley, CA
JavaScript
6
star
48

Journal

Backbone.js / Node.js multi-user journal app
CoffeeScript
6
star
49

gatsby-theme-cooper-hewitt

JavaScript
6
star
50

gatsby-starter-theme-cooper-hewitt

Starter for gatsby-theme-cooper-hewitt
JavaScript
6
star
51

gatsby-starter-blog-child-theme

Starter for creating a child theme for gatsby-theme-blog
JavaScript
6
star
52

react-html-elements-styleguide

React styleguide component
JavaScript
6
star
53

react-message

React component for showing status messages
CoffeeScript
6
star
54

eduglu_features

Core eduglue features
PHP
5
star
55

Family-History-Distro-features

Features for the Family History Drupal Distro
PHP
5
star
56

create-gatsby-fs-routes

wee prototype
JavaScript
5
star
57

eduglu_make

Drush Make file for eduglu
4
star
58

reactive-static-generation-benchmarks

Benchmarks for testing Reactive Static Generation vs SSG/SSR
TypeScript
4
star
59

docker-xelatex

Docker container with Xelatex and high quality free fonts installed
Shell
4
star
60

index-gatsby-blog-demo

Gatsby starter for a Contentful project.
JavaScript
4
star
61

gatsby-plugin-emoji-cursor

Gatsby plugin to add emjois which trail behind your cursor
JavaScript
4
star
62

brunch-backbone-widgets

Reusable Widgets for apps built with Backbone.js + Brunch + Sass/Compass
JavaScript
4
star
63

lmdb-backed-array

LMDB-backed array implementation for node.js for lowering memory usage for huge arrays.
JavaScript
4
star
64

every-second

A Gatsby site which which updates a time counter every second
CSS
4
star
65

hapi-dynamic-scope

Create dynamic route scopes based on information in the request
JavaScript
4
star
66

gatsby-plugin-inspector

Use Node.js inspector API to sample CPU/memory of a Gatsby build
JavaScript
4
star
67

gatsby-shopify-wordpress-demo

A Gatsby starter using the latest Shopify plugin showcasing a store with product overview, individual product pages, and a cart
JavaScript
4
star
68

backbone.js-practice

JavaScript
3
star
69

agility-gatsby-starter2

A sample GatsbyJS website using the Agility CMS Gatsby source plugin
3
star
70

gatsby-starter-shopify

A Gatsby starter using the latest Shopify plugin showcasing a store with product overview, individual product pages, and a cart
JavaScript
3
star
71

Family-History-distro-HTML-mockup

mockup yo
JavaScript
3
star
72

eduglu_profile

Install profile (think distro) for Drupal
3
star
73

test-recipes

some API ideas
JavaScript
3
star
74

gatsby-starter-theme-hyde

Starter for gatsby-theme-hyde
JavaScript
3
star
75

gatsby-cli-exploration

exploring some ideas for new UI for gatsby cli
JavaScript
3
star
76

reactjs-twitter-stream-example

Example React.js / Node.js app that streams tweets
JavaScript
3
star
77

hapi-death

Help Hapi.js die gracefully by intercepting SIGINT and SIGTERM and calling server.stop()
JavaScript
3
star
78

familyhistorydistro

Drupal Family History Distro
PHP
3
star
79

fun-with-fauna

JavaScript
2
star
80

atrium_book

port of atrium_book to Eduglu, KIT-complient, likely soon to be superceeded by new atrium_book version
PHP
2
star
81

BYU-Starter-Drupal-Profile

.make file and .profile file for a basic BYU Drupall install
2
star
82

hapi-influx

Hapi plugin to create a shared InfluxDB client
CoffeeScript
2
star
83

gc-functions-test

JavaScript
2
star
84

dewey

Theme for Eduglu
PHP
2
star
85

image-processing-benchmark

CSS
2
star
86

notesfromquarantinechurch-blog

JavaScript
2
star
87

react-flickr-example

Flickr search page build with React
CSS
2
star
88

gatsby-source-airtable-demo

TypeScript
2
star
89

bug-report-123

JavaScript
2
star
90

Drupal-Flot

Fork of Drupal flot module to keep track of patches / changes I make
PHP
2
star
91

sanity-kitchen-sink

Kitchen Sink
JavaScript
2
star
92

trello-flow

Create a Cumulative Flow Diagram from your Trello Board(s)
CoffeeScript
2
star
93

react-simple-form-inline-styles

Simple inline styles for React forms
CoffeeScript
2
star
94

file-upload-tests

Testing the fastest way to upload files w/ Node.js on Linux
JavaScript
2
star
95

agility-gatsby-starter

A sample GatsbyJS website using the Agility CMS Gatsby source plugin
2
star
96

preview-testing

Gatsby starter for a Contentful project from the community.
JavaScript
2
star
97

agility-starter-2

JavaScript
2
star
98

gatsby-site

Gatsby Site
JavaScript
2
star
99

the-nope-game

thenopegame.com (or whatever the domain will be)
JavaScript
2
star
100

static-query-bug-repo

JavaScript
2
star