@darkobits/vite-plugin-favicons
TypeScript icon, indicating that this package has built-in type declarations

0.3.2 • Public • Published

Yet another favicons plugin. 🤷

Features

  • Specify different source assets for each icon type (ie: favicon.png for favicons, startup.png for Apple startup screen, etc.).
  • Rendered assets are cached to disk. Rebuilds run in ~40ms. ✨

Install

npm install --save-dev @darkobits/vite-plugin-favicons

Use

The plugin accepts a FaviconOptions object used to configure favicons, with the following differences:

import { defineConfig } from 'vite';
import { faviconsPlugin } from '@darkobits/vite-plugin-favicons';

export default defineConfig(() => ({
  plugins: [
    faviconsPlugin({
      /**
       * Whether to inject the HTML fragments generated by `favicons` into the
       * compilation's HTML document.
       *
       * @default `true`
       */
      inject: true,

      /**
       * Whether to cache generated assets for faster rebuilds.
       *
       * @default `true`
       */
      cache: true,

      // Any additional `favicons` configuration options may be used here.

      /**
       * Specify each icon type to render. Unlike `favicons`, this plugin is
       * opt-in, meaning only the icon types you declare here will be rendered.
       *
       * For each icon type, all `favicons` options are supported. An
       * additional `source` property is required to indicate the asset to be
       * used for that icon type.
       */
      icons: {
        favicons: {
          source: './assets/favicon.png'
        },
        android: {
          source: './assets/android.png'
        },
        appleStartup: {
          source: './assets/apple-startup.png'
        }
        // ...etc.
      }
    })
  ]
}));

Prior Art


Package Sidebar

Install

npm i @darkobits/vite-plugin-favicons

Weekly Downloads

604

Version

0.3.2

License

Hippocratic

Unpacked Size

71.5 kB

Total Files

24

Last publish

Collaborators

  • darkobits