@types/mini-html-webpack-plugin
TypeScript icon, indicating that this package has built-in type declarations

2.2.5 • Public • Published

Installation

npm install --save @types/mini-html-webpack-plugin

Summary

This package contains type definitions for mini-html-webpack-plugin (https://github.com/styleguidist/mini-html-webpack-plugin).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/mini-html-webpack-plugin.

index.d.ts

import { compilation, Plugin } from "webpack";

/**
 * A miniature version of html-webpack-plugin with only necessary features
 * see {@link https://www.npmjs.com/package/mini-html-webpack-plugin}
 */
declare class MiniHtmlWebpackPlugin extends Plugin {
    constructor(options?: MiniHtmlWebpackPlugin.PluginOptions);
    plugin(compilation: compilation.Compilation, callback: () => void): void;
}

declare namespace MiniHtmlWebpackPlugin {
    interface AttributesType {
        [attributeName: string]: string | boolean;
    }

    interface PluginOptions {
        /** Optional, defaults to `index.html` */
        filename?: string | undefined;
        publicPath?: string | undefined;
        context?: PluginContext | undefined;
        /** Optional, use this for choosing chunks to include to your page. */
        chunks?: string[] | undefined;
        /** define a template function to generate your own code */
        template?: ((context: PluginContext) => string | Promise<string>) | undefined;
    }

    interface PluginContext {
        title?: string | undefined;
        /** Optional, defaults to `{ lang: 'en' }` */
        htmlAttributes?: AttributesType | undefined;
        /** Optional, any additional HTML attached within <head> */
        head?: string | undefined;
        /** Optional, any additional HTML attached within <body> */
        body?: string | undefined;
        css?: string[] | undefined;
        cssAttributes?: AttributesType | undefined;
        js?: string[] | undefined;
        jsAttributes?: AttributesType | undefined;
        publicPath?: string | undefined;
    }

    type GenerateCSSReferencesOptions = GenerateAttributesOptions & FilesOptions;

    type GenerateJSReferencesOptions = GenerateAttributesOptions & FilesOptions;

    interface FilesOptions {
        files?: string[] | undefined;
        publicPath?: string | undefined;
    }

    interface GenerateAttributesOptions {
        attributes?: AttributesType | undefined;
    }

    function defaultTemplate(options?: PluginContext): string;
    function generateAttributes(options?: GenerateAttributesOptions): string;
    function generateCSSReferences(options?: GenerateCSSReferencesOptions): string;
    function generateJSReferences(options?: GenerateJSReferencesOptions): string;
}

export = MiniHtmlWebpackPlugin;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: @types/webpack

Credits

These definitions were written by Piotr Błażejewicz (Peter Blazejewicz).

Readme

Keywords

none

Package Sidebar

Install

npm i @types/mini-html-webpack-plugin

Weekly Downloads

30

Version

2.2.5

License

MIT

Unpacked Size

7.51 kB

Total Files

5

Last publish

Collaborators

  • types