Description

HTML baking library

Package Information

Version0.1.6 (2016-Dec-01)
Repository https://github.com/eBookingServices/embaked
LicenseMIT License
CopyrightCopyright © 2015, Márcio Martins
AuthorsMárcio Martins
Registered byMárcio Martins
Dependencies

cssd

htmld

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

embaked

D library to bake HTML, CSS, and images into simple HTML.

This is useful for sending nice HTML emails with low spam score.

Uses htmld and cssd.

Example usage:

import embaked;

auto baked = embake(`
  <html>
    <style>
      h1 {
        background:black;
      }
    </style>
    <link rel=stylesheet href="/css/email.css" />
    <body>
      <h1>mooooo</h1>
      <img src="/flags/PT.png" alt="pt" />
    </body>
  </html>`, Options.Default | Options.BakeContentID, [ "/var/local/www/assets/" ]);

  writeln(baked.html);
  foreach(c; baked.content)
    writeln("replaced content: ", c.id); // c.content, c.mime, c.encoding also available

Output:

<html>
  <body style="background-color:#fff;color:#343a3f;font-family:Arial;font-size:14px;line-height:18px;margin:0;">
    <h1 style="background:black;font-family:Arial;font-weight:700;line-height:18px;margin:9px 0;">mooooo</h1>
    <img src="cid:dedce7cf4811cb3ae93044d400b3d603" />
  </body>
</html>
replaced content: dedce7cf4811cb3ae93044d400b3d603

Available versions

0.1.6 0.1.5 0.1.4 0.1.3 0.1.2 0.1.1 0.1.0 ~master