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

metalsmith-favicons

v1.0.0

Published

A Metalsmith favicons generator.

Downloads

35

Readme

Metalsmith Favicons

A Metalsmith plugin that will generate all your favicons (using favicons) from a suitable source image.

Install

npm install metalsmith-favicons --save

Options

metalsmith-favicons takes options similar to favicons, with some small additions and changes. Below is a list of properties and their defaults.

{
  src: '**/favicon.png',          // A pattern defining your source image used to generate favicons.
  dest: false,                    // The destination directory, same as src dir if not set.
  appName: null,                  // Your application's name. `string`
  appDescription: null,           // Your application's description. `string`
  developerName: null,            // Your (or your developer's) name. `string`
  developerURL: null,             // Your (or your developer's) URL. `string`
  background: "#fff",             // Background colour for flattened icons. `string`
  url: "/",                       // Absolute URL for OpenGraph image. `string`
  display: "standalone",          // Android display: "browser" or "standalone". `string`
  orientation: "portrait",        // Android orientation: "portrait" or "landscape". `string`
  version: "1.0",                 // Your application's version number. `number`
  logging: false,                 // Print logs to console? `boolean`
  online: false,                  // Use RealFaviconGenerator to create favicons? `boolean`
  icons: {
    android: false,              // Create Android homescreen icon. `boolean`
    appleIcon: false,            // Create Apple touch icons. `boolean`
    appleStartup: false,         // Create Apple startup images. `boolean`
    coast: false,                // Create Opera Coast icon. `boolean`
    favicons: true,              // Create regular favicons. `boolean`
    firefox: false,              // Create Firefox OS icons. `boolean`
    opengraph: false,            // Create Facebook OpenGraph image. `boolean`
    twitter: false,              // Create Twitter Summary Card image. `boolean`
    windows: false,              // Create Windows 8 tile icons. `boolean`
    yandex: false                // Create Yandex browser icon. `boolean`
  }
}

Example

metalsmith.json config example:

{
  "plugins": {
    "metalsmith-favicons": {
      src: '**/logo.png',
      dest: 'favicons/',
      icons: {
        android: true, 
        appleIcon: true, 
        favicons: true
      }
    }
  }
}

Build script example:

var metalsmith = require('metalsmith');
var markdown = require('metalsmith-markdown');
var favicons = require('metalsmith-favicons');


metalsmith(__dirname)
  .source('src')
  .destination('pub')
  .use(favicons({
    src: '**/logo.png',
    dest: 'favicons/',
    icons: {
      android: true, 
      appleIcon: true, 
      favicons: true
    }
  }))
  .use(markdown({
    gfm: true,
    tables: true
  }))
  .build(function (err) {
    if (err) {
      throw err;
    }
  });

metalsmith-favicons will add a favicons property to metalsmith.metadata() with one property html, which is an array of the meta and link tags for use in your templates. Loop over this html array to add the needed tags in your html head so your new favicons show up on your site.

An example in Jade:

html
  head
    if favicons && favicons.html
      each item in favicons.html
        != item

Caveats

You need Node 4.x or above, see favicons for more info.