UNPKG

@flexis/favicons

Version:

A tool for generating icons for the modern web.

64 lines 2.62 kB
/// <reference types="node" /> import Vinyl from 'vinyl'; import { IIconConfig, IIconsConfig, IIconToGenerateConfig, IManifestConfig, IHeadersConfig, IHtmlHeader, IRenderConfig } from './types'; export interface IConfig { /** * Relative public path to use in webmanifest and html-headers. */ path?: string; /** * Webmanifest to add icons. Also can use it to get background color. */ manifest?: IManifestConfig; /** * Output icons configuration. */ icons?: IIconsConfig; } export declare abstract class FaviconsGenerator { protected readonly config: IConfig; constructor({ path, manifest, icons }?: IConfig); protected abstract attachMetadata(source: Vinyl): Promise<Vinyl>; protected abstract renderIcon(sources: Vinyl[], config: IRenderConfig): Promise<Buffer>; /** * Create favicons form sources. * @param sources - Favicons sources. * @returns Results of handling. */ generateIcons(source: Vinyl | Vinyl[]): AsyncGenerator<Vinyl, void, unknown>; /** * Create full manifest object with icons. * @returns Manifest object. */ generateManifset(): IManifestConfig; /** * Create HTML-headers for target icons. * @param headersConfig - Custom headers config. * @returns Array of headers objects. You can get HTML-markup with `getHtmlHeadersMarkup` helper. */ generateHtmlHeaders(headersConfig?: IHeadersConfig): IHtmlHeader[]; /** * Create icons of given type. * @param iconsType - Type of needed icons. * @param sources - Icons sources. * @returns Icons of given type. */ protected generateIconsOfType(iconsType: string, sources: Vinyl[]): AsyncGenerator<Vinyl, void, unknown>; /** * Create icon. * @param filename - File name of icon. * @param sources - Sources of icon. * @param iconConfig - Icon config. * @param iconToGenerateConfig - Icon to generate config. */ protected generateIcon(filename: string, sources: Vinyl[], iconConfig: IIconConfig, iconToGenerateConfig: IIconToGenerateConfig): Promise<Vinyl>; /** * Create ".ico" icon. * @param filename - File name of icon. * @param sources - Sources of icon. * @param iconConfig - Icon config. * @param iconToGenerateConfig - Icon to generate config. */ protected generateIco(filename: string, sources: Vinyl[], iconConfig: IIconConfig, iconToGenerateConfig: IIconToGenerateConfig): Promise<Vinyl>; } //# sourceMappingURL=FaviconsGenerator.d.ts.map