npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

google-webfonts-json-encoder

v0.1.10

Published

"Given a list of available google font subsets and families, download the specified family, subset and variants, in several formats, encoding them as json"

Downloads

409

Readme

google-webfonts-json-encoder

Download and encode google fonts as base64 json (ttf and woff). This tool is intended to be used in the build process of BaseKit app, but can be easily adapted to use in any other project.

Quick guide

Installation: npm install -g google-webfonts-json-encoder

Note: You can install it locally to your project as well. Remember to add the path to run it.

You need a Google API key to use the tool, and set an environment variable named GOOGLE_API_KEY with its value.

Usage: GOOGLE_API_KEY=your_key_here gwjencoder -l config/google_fonts.yml -d assets/public/fonts -s=latin,latin-ext

The minimun version of node needed to run it is 0.12.

Where -l is the path of a yml file listing the desired fonts (legacy format used in the app), -d is the folder to store the fonts, and -s the desired subsets of fonts.

How to use

This is intended to be part of an automated build process depending on the required fonts for a given target environment.

The complete list of command line options are:

  • l: path to the yml file, defaults to config/google_fonts.yml.

  • d: target folder, defaults to current one.

You can set your own defaults in config.js.

YAML font list

This is an example of our format, if you use another one, just adapt it to your own, specifying its name in config.js (fontListFormat option) and creating a loader and a parser with that name, ended in Loader and Parser respectively.


fonts:

latin:

    subset: 'latin'

    fonts:

        - family: 'Droid+Sans'

          size: '400,700'

        - family: 'Arvo'

          size: ''

'latin-ext': 

    subset: 'latin,latin-ext'

    fonts:

        - family: 'Droid+Sans'

          size: '400,700'

Disclaimer

The architecture is crap. It lacks test for the most important stuff (downloading and converting the fonts). It could be more deocupled and it should have used own EventEmitters and pipe all of them. Also it doesn't deal with any kind of errors.

Use it at your own risk.

License

CC BY 4.0

Acknowledge

Thanks to Mario Ranftl for his font downloading service, used in the early versions of this tool.