{"library":"scow","title":"Scow HTML Email Inliner & Bundler","description":"Scow is an HTML email inliner and bundler designed to prepare modern HTML and CSS for consistent rendering across a diverse range of email clients. Historically, email clients exhibit inconsistent support for external stylesheets and `<style>` tags within the `<head>` of an HTML document, often stripping them entirely. This necessitates that CSS be applied directly as `style` attributes on individual HTML elements for reliable presentation. Scow automates this critical inlining process, abstracting away the complexities of email client rendering quirks. Additionally, it aims to bundle associated assets like images, potentially converting them to data URIs. Currently available as `4.0.0-alpha.5`, the package is undergoing active alpha development, meaning its API and feature set are subject to change without strict adherence to semantic versioning until a stable release. Its core value lies in streamlining the email development workflow, ensuring that visually rich emails display as intended, despite the varied and often outdated rendering engines used by different email services and applications.","language":"javascript","status":"active","last_verified":"Thu Apr 23","install":{"commands":["npm install scow"],"cli":{"name":"scow","version":null}},"imports":["import { inline } from 'scow';","import type { ScowConfig } from 'scow';","import { bundleAssets } from 'scow';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { inline } from 'scow';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nasync function processEmailTemplate() {\n  const templatePath = join(process.cwd(), 'email-template.html');\n  const htmlContent = readFileSync(templatePath, 'utf-8');\n\n  // Assume email-template.html looks something like:\n  // <html><head><style>h1 { color: #1a73e8; }</style></head><body><h1>Hello, World!</h1></body></html>\n\n  try {\n    const inlinedHtml = await inline(htmlContent, {\n      // Optional configuration, e.g., to keep original style tags for media queries\n      // keepOriginalStyleTags: true,\n      // Optional: Specify base URL for resolving relative paths if bundling external assets\n      // baseUrl: 'https://example.com/assets/',\n    });\n    console.log('Successfully inlined HTML:\\n', inlinedHtml);\n  } catch (error) {\n    console.error('Error inlining email:', error);\n  }\n}\n\nprocessEmailTemplate();\n\n// To make this runnable, create a file named 'email-template.html' in the same directory:\n// <!-- email-template.html -->\n// <!DOCTYPE html>\n// <html>\n// <head>\n//   <meta charset=\"utf-8\">\n//   <title>Styled Email</title>\n//   <style type=\"text/css\">\n//     body { font-family: sans-serif; margin: 0; padding: 20px; background-color: #f6f6f6; }\n//     .container { max-width: 600px; margin: 0 auto; background-color: #ffffff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); }\n//     h1 { color: #333333; font-size: 24px; margin-bottom: 15px; }\n//     p { color: #555555; font-size: 16px; line-height: 1.5; }\n//     .button { display: inline-block; padding: 10px 20px; margin-top: 20px; background-color: #1a73e8; color: #ffffff; text-decoration: none; border-radius: 5px; }\n//     @media only screen and (max-width: 620px) {\n//       .container { width: 100% !important; border-radius: 0; }\n//       body { padding: 0; }\n//     }\n//   </style>\n// </head>\n// <body>\n//   <div class=\"container\">\n//     <h1>Welcome to Our Service!</h1>\n//     <p>Thank you for signing up. We're excited to have you on board.</p>\n//     <p>Explore our features and get started today.</p>\n//     <a href=\"#\" class=\"button\">Get Started</a>\n//   </div>\n// </body>\n// </html>","lang":"typescript","description":"This quickstart demonstrates how to use `scow` to inline CSS styles from a `<style>` block in an HTML email template directly into the HTML elements' `style` attributes, preparing it for various email clients. It also shows basic error handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}