3 个版本
| 0.1.2 | 2020年6月21日 | 
|---|---|
| 0.1.1 | 2020年6月17日 | 
| 0.1.0 | 2020年6月11日 | 
#442 in 模板引擎
26KB
427 行
静态电子邮件(模板)生成器
MEYL 是一个以开发者优先和可访问性优先的电子邮件生成应用程序。我编写此应用程序是为了使用模板引擎创建、编辑、测试和管理所有电子邮件。您可以用于生成单个电子邮件,也可以为 Mandrill、SendGrid、Zapier 等创建可重用的电子邮件模板。
您还可以编辑基于文本的电子邮件内容,以便视觉障碍人士或 OCR 用户使用,但如果有任何遗忘,MEYL 将为您自动生成。
简单用法
# create new project directory
meyl new email-templates
# generate emails
meyl generate --source=email-templates/src/ \
              --destination=email-templates/dst/
# send a test mail to preview
meyl send --template=email-templates/dst/wedding-invitation/ \
          --email="john.doe@localhost"
不可变变量
- 主题
- 正文
电子邮件文件夹结构
所有模板都应该有
- 一个 subject.html,
- 和一个 body.html。
您不需要创建 body_text.html,但在需要的情况下,MEYL 将自动生成它,以便使您的电子邮件对所有人更加可访问。
email-templates
|
|- dst                       Destination Template Folder
|  |- payroll                Template Name: Payroll
|  |  |- body.html           Email Content
|  |  |- body_text.html      Email Content (in Text Format)
|  |  |- subject.html        Subject
|  |
|  |- wedding-invitation     Template Name: Wedding Invitation
|  |  |- body.html           Email Content
|  |  |- body_text.html      Email Content in Text Format
|  |  |- subject.html        Subject
|
|- src                       Source Template Folder
|  |- base.html              Base Template
|  |- style.css              Styles
|  |- partials               Template Partials
|  |  |- button.html
|  |  |- title.html
|  |- payroll
|  |  |- body.html
|  |  |- subject.html
|  |- wedding-information
|  |  |- body.html
|  |  |- body_text.html
|  |  |- subject.html
|
待办事项
- 多语言支持。
- 压缩 CSS 样式到 HTML 内部。
- 支持将 markdown 文件嵌入到电子邮件正文中作为变量。
- 每次发布时自动生成可执行文件(linux、win、mac)。
- 只允许 HTML 文件中的 BODY 内容,我们可以通过程序添加 HTML 和 HEAD 部分。
- 测试渲染输出。
- 更改 Email 结构参数:src_dir、dst_dir、template_name。
- 最小化渲染输出。
- 将 CSS 样式内联到 HTML 模板中。
- 选择模板引擎以渲染电子邮件内容。
- 我还需要一个用于 CLI 的 arg 解析器。
- 创建项目骨架。
依赖关系
~12–22MB
~310K SLoC