@types/inline-critical
TypeScript icon, indicating that this package has built-in type declarations

5.3.4 • Public • Published

Installation

npm install --save @types/inline-critical

Summary

This package contains type definitions for inline-critical (https://github.com/bezoerb/inline-critical#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/inline-critical.

index.d.ts

export = inline;

/**
 * @param html The HTML to use to inline critical styles.
 * @param styles The styles to inline.
 * @param options Optional configuration object.
 * @example
 * const html = fs.readFileSync('test/fixtures/index.html', 'utf8')
 * const critical = fs.readFileSync('tests/fixtures/critical.css', 'utf8')
 * const inlined = inline(html, critical)
 *
 * // ignoring stylesheets matching regex
 * const inlined = inline(html, critical, {ignore: [/bootstrap/]})
 */
declare function inline(html: string, styles: string, options?: inline.Options): string;

declare namespace inline {
    interface Options {
        /**
         * Whether to minify the styles before inlining.
         * @default true
         */
        minify?: boolean | undefined;

        /**
         * Whether to remove the inlined styles from any stylesheets referenced in the HTML.
         * @default false
         */
        extract?: boolean | undefined;

        /**
         * The path to be used when extracting styles to find the files references by `href` attributes.
         * @default process.cwd
         */
        basePath?: string | undefined;

        /**
         * Stylesheets to ignore when inlining.
         * @default []
         * @example [/bootstrap/]
         */
        ignore?: string | RegExp | Array<string | RegExp> | undefined;

        /** The selector for the element used by loadCSS as a reference for inlining. */
        selector?: string | undefined;

        /**
         * The position of the `noscript` fallback.
         * * `body`: end of body
         * * `head`: end of head
         * * `false`: no `noscript`
         * @default 'body'
         */
        noscript?: "body" | "head" | false | undefined;

        /**
         * Whether to add loadCSS if it's not already loaded.
         * @default true
         */
        polyfill?: boolean | undefined;

        /**
         * Paths to use in the `href` tag of the `link` elements.
         * @default false
         */
        replaceStylesheets?: string[] | false | undefined;
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by cherryblossom.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/inline-critical

Weekly Downloads

258

Version

5.3.4

License

MIT

Unpacked Size

6.78 kB

Total Files

5

Last publish

Collaborators

  • types