juice.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Type definitions for Juice 3.0.0
  2. // Project: https://github.com/Automattic/juice
  3. // Definitions by: Kamil Nikel <https://github.com/knikel>
  4. /* =================== USAGE ===================
  5. import juice = require('juice');
  6. =============================================== */
  7. export = juice;
  8. declare function juice(html: string, options?: juice.Options): string;
  9. declare namespace juice {
  10. export function juiceResources(html: string, options: Options, callback: Callback): string
  11. export function juiceFile(filePath: string, options: Options, callback: Callback): string
  12. export function juiceDocument($: any, options?: Options): any
  13. export function inlineContent(html: string, css: string, options?: Options): string
  14. export function inlineDocument($: any, css: string, options?: Options): any
  15. export let codeBlocks: { [index: string]: { start: string, end: string } };
  16. export let excludedProperties: string[];
  17. export let heightElements: HTMLElement[];
  18. export let ignoredPseudos: string[];
  19. export let nonVisualElements: HTMLElement[];
  20. export let styleToAttribute: { [index: string]: string };
  21. export let tableElements: HTMLElement[];
  22. export let widthElements: HTMLElement[];
  23. export interface Callback { (err: Error, html: string): any; }
  24. interface Options {
  25. extraCss?: string;
  26. applyStyleTags?: boolean;
  27. removeStyleTags?: boolean;
  28. preserveMediaQueries?: boolean;
  29. preserveFontFaces?: boolean;
  30. preserveKeyFrames?: boolean;
  31. preservePseudos?: boolean;
  32. insertPreservedExtraCss?: boolean;
  33. applyWidthAttributes?: boolean;
  34. applyHeightAttributes?: boolean;
  35. applyAttributesTableElements?: boolean;
  36. webResources?: WebResourcesOptions;
  37. inlinePseudoElements?: boolean;
  38. xmlMode?: boolean;
  39. preserveImportant?: boolean;
  40. }
  41. interface WebResourcesOptions {
  42. fileContent?: string;
  43. inlineAttribute?: string;
  44. images?: boolean | number;
  45. svgs?: boolean | number;
  46. scripts?: boolean | number;
  47. links?: boolean | number;
  48. relativeTo?: string;
  49. rebaseRelativeTo?: string;
  50. strict?: boolean;
  51. }
  52. }