Socket
Socket
Sign inDemoInstall

gulp-simplefont64-updated

Package Overview
Dependencies
97
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-simplefont64-updated

Create base64 data from font files and group them into appropriate font families


Version published
Maintainers
1
Created

Readme

Source

gulp-simplefont64

Build Status NPM version

Encode base64 data from font-files and store the resulting fonts grouped according to font-family in a css file.

Encoding fonts in base64 is great but often you just end up with a list of font-families like: PlayfairDisplay-Black, PlayfairDisplay-Regular, PlayfairDisplay-Italic, instead of just grouping them all under the same font-family and giving the font faces the appropriate rule declarations.

For gulp-simplefont64, just name your fonts in the following format:

FontFamily-Style1-Style2...

For example:

PlayfairDisplay-Black-Italic.otf

And gulp-simplefont64 will give it the appropriate rulesets underneath the PlayfairDisplay font family (font-weight: 800; and font-style: italic;).

Example

gulpfile.js
var gulp = require('gulp');
var font64 = require('gulp-simplefont64');

gulp.task('fonts', function() {
    return gulp.src(['src/fonts/**/*.otf', 'src/fonts/**/*.ttf'])
        .pipe(font64())
        .pipe(gulp.dest('dist/stylesheets/'));
});
Contents of "src/fonts":
    +-- src
    |   +--fonts
    |      +-- PlayfairDisplay-Black-Italic.otf
Result of plugin:
@font-face {
  font-family: PlayfairDisplay;
  font-weight: 800;
  font-style: italic;
  src: url("playfair-display/data: font/opentype; base64,T1RUTwAMAIAAAwBAQ0ZGICNw7jIAABE8AAFw1UdERUYSkBS7AAGPSAAAAERHUE9TXJ5OgwABqaAAAJDYR1NVQmMeE9EAAY+MAAAaFE9TLzJuRIYyAAABMAAAAGBjbWFw5kH1tQAACbgAAAdkaGVhZANwzXwAAADMAAAANmhoZWERJQwdAAABBAAAACRobXR4PCvh+gABghQAAA00bWF4cANNUAAAAAEoAAAABm5hbWUD6eGxAAABkAAACCdwb3N0/zwAKQAAERwAAAAgAAEAAAABAQbN9rJqXw889QADCAAAAAAAzmtAdgAAAADOa0B2/Qr9/ 
};

Keywords

FAQs

Last updated on 03 Mar 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc