Skip to content

Latest commit

 

History

History
42 lines (34 loc) · 1.32 KB

README.md

File metadata and controls

42 lines (34 loc) · 1.32 KB

Inline Icon Extension for HTML Webpack Plugin

CI workflow status

Extension to HtmlWebpackPlugin which embeds icons as data URLs in the output HTML file. Inspired by InlineChunkHtmlPlugin from react-dev-utils package.

Installation

npm install --save-dev html-webpack-inline-icon-plugin

Usage

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const InlineIconHtmlPlugin = require("html-webpack-inline-icon-plugin");

module.exports = {
  // ...
  plugins: [
    // Generate `index.html` with favicon injected.
    new HtmlWebpackPlugin({
      inject: true,
      template: path.resolve(__dirname, "public/index.html"),
      favicon: path.resolve(__dirname, "public/favicon.png"),
    }),
    // Inline icons with `favicon` in the name.
    new InlineIconHtmlPlugin(HtmlWebpackPlugin, [/favicon/]),
    // ...
  ],
  // ...
};