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

ebay-font

v1.2.3

Published

A module to load ebay font

Downloads

15

Readme

ebay-font Build Status

ebay-font is the module used at eBay to load custom web fonts. It uses a strategy to avoid both FOUT and FOIT. This can be considered equivalent to the new CSS @font-face descriptor font-display: optional. Unfortunately, font-display is relatively new and hence its adoption among browsers is not widespread. So for now, this module leverages localStorage, FontFaceSet API and the Font Face Observer utility (as a backup if FontFaceSet API is not present) to provide the same functionality as font-display: optional.

ebay-font is paired along with eBay's custom font 'Market Sans'. But feel free to change it to any custom font URL of your choice.

Please refer to the detailed blog post "eBay’s Font Loading Strategy" for a full overview of how this module works.

Usage

ebay-font can be used along with other eBay open source modules Skin, Marko & Lasso, as well as in standalone mode. If you are in the eBay workflow environment, please follow the below steps

  1. Install and save the module
npm install ebay-font --save
  1. Add dependency in your page browser.json
"ebay-font/browser.json"
  1. The module exposes a tag <ebay-font> to embed in the <head> tag of page HTML
<html>
<head>
    <ebay-font/>
    ... 
</head>
...
</html>
  • Note: If your website uses Content Security Policy (CSP), you can pass the CSP nonce value to <ebay-font> tag
...
    <ebay-font nonce="4AEemGb0xJptoIGFP3Nd"/>
...

Standalone

  1. Copy paste this CSS and JavaScript tag snippet in the <head> tag of your page

  2. Include the generated JavaScript file fontloader.standalone.js in the footer

<script async src="fontloader.standalone.js"></script>

Browser support

  • Chrome (desktop & Android)
  • Firefox
  • Opera
  • Safari (desktop & iOS)
  • IE8+
  • Android WebKit

Issues

Have a bug or a feature request? Please open a new issue

Open browser issues

  • Chrome — Very randomly on a new session, all font formats are getting downloaded if font-display is present in the font-face. Filed a bug to track it.

Maintainers

Contribute

Pull Requests welcome. Please submit Github issues for any feature enhancements, bugs or documentation problems.

License

Copyright (c) 2017 eBay Inc.

Released under the MIT License