metalsmith-inline-critical-css
Version:
Metalsmith plugin to inspect HTML files, inline used selectors from specified CSS, and load the rest asynchronously.
17 lines (16 loc) • 598 B
TypeScript
export default plugin;
interface IOptions {
/** A multimatch pattern of files to run on. */
pattern: string;
/** The name of the css file in the metalsmith data. */
cssFile: string;
/**
* The path under which the css is included in the template.
* Important for knowing which <link> tag to replace.
*/
cssPublicPath: string;
}
/**
* Metalsmith plugin to inline critical css, and load the rest asynchronously.
*/
declare function plugin({ pattern, cssFile, cssPublicPath }: IOptions): (files: Record<string, any>, metalsmith: any, done: () => void) => void;