UNPKG

@maizzle/framework

Version:

Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.

47 lines (46 loc) 1.54 kB
import { ChildNode } from "domhandler"; //#region src/transformers/shorthandCss.d.ts /** * Options for the `shorthandCss` transformer. */ interface ShorthandCssOptions { /** * Restrict the transform to a list of HTML tag names. Omit to apply to * every element with a `style` attribute. * * @example ['td', 'div'] */ tags?: string[]; } /** * Rewrite longhand CSS inside inline `style` attributes with shorthand * syntax. Works with margin, padding, and border when all sides are * specified. * * For example: * `margin-left: 2px; margin-right: 2px; margin-top: 4px; margin-bottom: 4px` * becomes: * `margin: 4px 2px` * * @param html HTML string to transform. * @param options Optional Maizzle options (`tags`). * @returns The transformed HTML string. * * @example * import { shorthandCss } from '@maizzle/framework' * * const out = shorthandCss( * '<p style="margin-top: 4px; margin-right: 2px; margin-bottom: 4px; margin-left: 2px;">x</p>', * { tags: ['p'] }, * ) */ declare function shorthandCss(html: string, options?: ShorthandCssOptions): string; /** * DOM-form of {@link shorthandCss} used by the internal transformer * pipeline. Takes a parsed DOM, returns a parsed DOM — avoids redundant * serialize/parse round-trips when chained with other transformers. */ declare function shorthandCssDom(dom: ChildNode[], options?: ShorthandCssOptions): ChildNode[]; //#endregion export { ShorthandCssOptions, shorthandCss, shorthandCssDom }; //# sourceMappingURL=shorthandCss.d.ts.map