Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@glhd/postcss-font-stack

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glhd/postcss-font-stack

A PostCSS plugin to use configured font stacks with fallback adjustments

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

postcss-font-stack

A PostCSS plugin to use configured font stacks with fallback adjustments.

Getting Started

First, you need to figure out for fallback configuration using the wonderful font style matcher.

Next, configure your font stack using the adjustments from the font style matcher:

Example Config

{
  stacks: {
    ui: {
      target: `Roboto`,
      fallbacks: `Arial, sans-serif`,
      adjustments: {
        letterSpacing: `-0.003125rem`,
        wordSpacing: `-0.009375rem`
      }
    }
  }
}

Use your font stack in anywhere in your CSS:

CSS

.btn {
  font-stack: ui;
}

If you're using Typekit, everything else is set up for you. If not, check out the font face observer library, and set up something along the lines of:

const fontObserver = new FontFaceObserver(`Roboto`);
fontObserver.load().then(() => {
	document.documentElement.className += ` has-roboto-font`;
});

Your final CSS will look something like this:

Example Output

.wf-loading .btn, .wf-inactive .btn {
  font-family: Arial, sans-serif;
  letter-spacing: -0.003125rem;
  word-spacing: -0.009375rem;
}
.wf-active .btn {
  font-family: Roboto, Arial, sans-serif;
}

Keywords

FAQs

Package last updated on 28 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc