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

css-font-local-cache

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-font-local-cache

encode fonts directly into css text for offline use

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

css-font-local-cache

github actions test npm downloads npm version

Allow using fonts linked in your CSS offline by enconding them in base64 into the CSS itself. I use this for offline-first Electron apps, but you can use it for whatever you want.

Install

npm install css-font-loca-cache

API

const { promises: fs } = require('fs');
const cssFontCache = require('css-font-local-cache');

(async () => {
  const input = await fs.readFile('./css-with-links.css', 'utf8');
  const output = await cssFontCache(input);
  await fs.writeFile('./css-with-base64-fonts.css', output);
})();

CLI

Encode CSS you already have on disk:

npx css-font-local-cache < css-with-links.css > css-with-base64-fonts.css

Encode CSS from a remote location:

npx css-font-loca-cache http://example.com/my-css > css-with-base64-fontd.css

Keywords

FAQs

Package last updated on 25 Oct 2020

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