@css-inline/css-inline
Version:
High-performance library for inlining CSS into HTML 'style' attributes
45 lines (40 loc) • 1.57 kB
TypeScript
/* auto-generated by NAPI-RS */
/* eslint-disable */
/** Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string. */
export declare function inline(html: string, options?: Options | undefined | null): string
/** Inline CSS styles into an HTML fragment. */
export declare function inlineFragment(html: string, css: string, options?: Options | undefined | null): string
export interface Options {
/**
* Whether to inline CSS from "style" tags.
*
* Sometimes HTML may include a lot of boilerplate styles, that are not applicable in every
* scenario, and it is useful to ignore them and use `extra_css` instead.
*/
inlineStyleTags?: boolean
/** Keep "style" tags after inlining. */
keepStyleTags?: boolean
/** Keep "link" tags after inlining. */
keepLinkTags?: boolean
/** Keep "at-rules" after inlining. */
keepAtRules?: boolean
/** Used for loading external stylesheets via relative URLs. */
baseUrl?: string
/** Whether remote stylesheets should be loaded or not. */
loadRemoteStylesheets?: boolean
/** An LRU Cache for external stylesheets. */
cache?: StylesheetCache
/** Additional CSS to inline. */
extraCss?: string
/**
* Pre-allocate capacity for HTML nodes during parsing.
* It can improve performance when you have an estimate of the number of nodes in your HTML document.
*/
preallocateNodeCapacity?: number
}
export interface StylesheetCache {
/** Cache size. */
size: number
}
/** Get the package version. */
export declare function version(): string