New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@unic/estatico-font-datauri

Package Overview
Dependencies
Maintainers
5
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unic/estatico-font-datauri

Uses `gulp-simplefont64` to inline font files into base64-encoded data URIs

  • 0.0.11
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

@unic/estatico-font-datauri

Uses gulp-simplefont64 to inline font files into base64-encoded data URIs

Installation

$ npm install --save-dev @unic/estatico-font-datauri

Usage

const gulp = require('gulp');
const env = require('minimist')(process.argv.slice(2));

/**
 * CSS font inlining task
 * Uses `gulp-simplefont64` to inline font files into base64-encoded data URIs
 *
 * Using `--watch` (or manually setting `env` to `{ watch: true }`) starts file watcher
 * When combined with `--skipBuild`, the task will not run immediately but only after changes
 */
gulp.task('css:fonts', () => {
  const task = require('@unic/estatico-font-datauri');

  const instance = task({
    src: [
      './src/assets/fonts/**/*',
    ],
    dest: './src/assets/.tmp',
    plugins: {
      concat: 'fonts.scss',
    },
    watch: {
      src: [
        './src/assets/fonts/**/*',
      ],
      name: 'css:fonts',
    },
  }, env);
  
  // Don't immediately run task when skipping build
  if (env.watch && env.skipBuild) {
    return instance;
  }

  return instance();
});

Run task (assuming the project's package.json specifies "scripts": { "gulp": "gulp" }): $ npm run gulp css:fonts

See possible flags specified above.

API

plugin(options, env) => taskFn

options

src (required)

Type: Object
Default: null

Each property is passed to gulp.src, the key is used for the generated sprite's name.

dest (required)

Type: String
Default: null

Passed to gulp.dest.

watch

Type: Object
Default: null

Passed to file watcher when --watch is used.

plugins

Type: Object

plugins.concat (required)

Type: String
Default: null

Passed to gulp-concat.

plugins.rename

Type: Function
Default: null

Result will be assigned to file.path before passing the file to gulp-simplefont64. This allows you to optionally generate file names which can be handled by the plugin (e.g. FontFamily-FontStyle).

logger

Type: { info: Function, debug: Function, error: Function }
Default: Instance of estatico-utils's Logger utility.

Set of logger utility functions used within the task.

env

Type: Object
Default: {}

Result from parsing CLI arguments via minimist, e.g. { dev: true, watch: true }. Some defaults are affected by this, see above.

License

Apache 2.0.

FAQs

Package last updated on 04 Oct 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