• Stars
    star
    291
  • Rank 142,563 (Top 3 %)
  • Language
    CoffeeScript
  • License
    Other
  • Created about 10 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Making email template development fun! Sort of!

Gleemail

Remember when developing HTML emails used to be fun? Nope, neither do I.

Gleemail is an attempt to change that. It's a local development environment for creating HTML emails that removes a lot of the headaches.

Gleemail Screenshot

Features

  • Build email templates with Mustache.
  • Write CSS using Stylus.
  • Custom Gleemail HTML tags cleanly render into unsightly nested table structures.
  • Automatically inlines CSS styles for you.
  • Export templates to other templating engines (MailChimp, Eloqua, FreeMarker, etc.)
  • Share Mustache and Stylus partials between email templates.
  • Live browser preview refreshes whenever you save changes to files.
  • View both HTML and text previews of an email in the browser.
  • Automatically upload images to S3, automatically reference them in test emails.
  • One-click test email delivery.
  • One-click project creation in Litmus and Eloqua.
  • Automatically render templates with dummy data from a JSON file.
  • CLI for rendering templates from the command line.

Demo Presentation

Getting Started

Install Node.js, then install the gleemail npm package globally:

npm install -g gleemail

Create a new project directory:

gleemail project my-project-dir-name

Edit config.json with your email, S3 and Litmus credentials, then start the server:

cd ./my-project-dir-name
gleemail start

Now you should be able to visit http://localhost:4433 in Chrome and you will be able to see the example email template. Use the UI to bootstrap your own templates, and the changes you make will be immediately displayed in the browser.

Rendering from the Command Line

To programmatically render templates in a script or from the command line, use the gleemail render command:

cd /path/to/project

# Render the HTML version with the first dummy data to stdout
gleemail render your-template-name > my-email.html

# Render using the third piece of dummy data
gleemail render your-template-name -i 2 > my-email.html

# Render the text version, use -o to specify output instead of stdout
gleemail render your-template-name -t text -o my-email.txt

# Render as a Mailchimp template
gleemail render your-template-name -r mailchimp > my-email.html

To view all the available rendering options, use gleemail help render.

Gleemail Markup

For all of these transformer "macro tags", any regular attributes (id, class, etc) that are placed on the macro element will be transferred to the generated element.

<gm-box>

This gives you a box model for padding around a piece of content using table cells.

<gm-box padding="10px 20px" class="some-class">
  <strong>Hello World</strong>
</gm-box>

<!-- becomes -->

<table class="some-class" style="width: 100%; border: none; border-collapse: collapse;" cellspacing="0" cellpadding="0" border="0">
  <tr style="border: none; border-collapse: collapse;">
    <td style="line-height: 0; border: none; border-collapse: collapse;" height="10" width="20">&nbsp;</td>
    <td style="line-height: 0; border: none; border-collapse: collapse;" height="10">&nbsp;</td>
    <td style="line-height: 0; border: none; border-collapse: collapse;" height="10" width="20">&nbsp;</td>
  </tr>
  <tr style="border: none; border-collapse: collapse;">
    <td style="line-height: 0; border: none; border-collapse: collapse;" width="20">&nbsp;</td>
    <td style="border: none; border-collapse: collapse;">
      <strong>Hello World</strong>
    </td>
    <td style="line-height: 0; border: none; border-collapse: collapse;" width="20">&nbsp;</td>
  </tr>
  <tr style="border: none; border-collapse: collapse;">
    <td style="line-height: 0; border: none; border-collapse: collapse;" height="10" width="20">&nbsp;</td>
    <td style="line-height: 0; border: none; border-collapse: collapse;" height="10">&nbsp;</td>
    <td style="line-height: 0; border: none; border-collapse: collapse;" height="10" width="20">&nbsp;</td>
  </tr>
</table>

<gm-stack>

This gives you a vertical stack of elements. Each child of the <gm-stack> is assumed to be its own row.

<gm-stack class="some-class">
  <p>Hello</p>
  <p>World</p>
  <p>!!!</p>
</gm-stack>

<!-- becomes -->

<table class="some-class" cellspacing="0" cellpadding="0" border="0">
  <tr style="border: none; border-collapse: collapse;">
    <td style="border: none; border-collapse: collapse;">
      <p>Hello</p>
    </td>
  </tr>
  <tr style="border: none; border-collapse: collapse;">
    <td style="border: none; border-collapse: collapse;">
      <p>World</p>
    </td>
  </tr>
  <tr style="border: none; border-collapse: collapse;">
    <td style="border: none; border-collapse: collapse;">
      <p>!!!</p>
    </td>
  </tr>
</table>

<gm-row> with <gm-col>

Using <gm-row> with nested <gm-col> elements gives you horizontally aligned content. Attributes placed on the <gm-col> elements are transferred to the generated <td>s.

<gm-row class="some-class">
  <gm-col width="100">Hello</gm-col>
  <gm-col width="200">World</gm-col>
  <gm-col width="300">!!!</gm-col>
</gm-row>

<!-- becomes -->

<table class="some-class" cellspacing="0" cellpadding="0" border="0">
  <tr style="border: none; border-collapse: collapse;">
    <td width="100" style="border: none; border-collapse: collapse;">
      Hello
    </td>
    <td width="200" style="border: none; border-collapse: collapse;">
      World
    </td>
    <td width="300" style="border: none; border-collapse: collapse;">
      !!!
    </td>
  </tr>
</table>

gm-centered Attribute

This attribute can be added to any tag to wrap its contents in a centered table. This is primarily useful on the <body> element.

<body gm-centered>
  <p>My body</p>
</body>

<!-- becomes -->

<body>
  <table style="width: 100%;" cellspacing="0" cellpadding="0" border="0">
    <tr style="border: none; border-collapse: collapse;">
      <td align="center" style="border: none; border-collapse: collapse;">
        <p>My body</p>
      </td>
    </tr>
  </table>
</body>

Creating Custom Transformer Macros

To write your own macros, add a hooks.js or hooks.coffee file to your project directory. It should export a function that take a hooks object, which has a number of methods on it including addTransformer(). Transformer functions can be synchronous or asynchronous, and this is determined by the presence of a second argument in the function signature.

For example:

// This is hooks.js

module.exports = function(hooks) {
  // Simple, synchronous macro
  // Turns:
  // <gm-green>This is green!</gm-green>
  // into:
  // <span style='color: green;'>This is green!</span>
  hooks.addTransformer(function($) {
    $("gm-green").each(function() {
      greenTag = $(this);
      span = $("<span style='color: green;'></span>");
      span.append(greenTag.contents());
      greenTag.after(span);
      greenTag.remove();
    });
  });

  // Asynchronous macro, requires passing $ back in the callback
  // Turns:
  // <gm-file path="/path/to/file.txt"></gm-file>
  // Into:
  // <pre>Contents of file...</pre>
  hooks.addTransformer(function($, cb) {
    fileTag = $("gm-file").eq(0); // for simplicity, let's say there's just one
    pre = $("<pre></pre>");
    filePath = fileTag.attr("path");
    require("fs").readFile(filePath, function(err, buffer) {
      if (err) return cb(err);
      pre.html(buffer.toString());
      fileTag.after(pre);
      fileTag.remove();
      cb(null, $);
    });
  });
});

Development

Please refer to CONTRIBUTING.md for contribution guidelines, any help is greatly appreciated!

After cloning the repository, do a setup and run the tests:

make setup
make test

The easiest way to use the gleemail command during development is to use the npm link command. This makes your local executable available as if you had installed it globally from npm:

npm link .

To make development easier, you can use these commands to auto-load changes in client and server code:

# In gleemail dir
make dev
# In project dir
gleemail dev

More Repositories

1

greenscreen

CoffeeScript
1,197
star
2

Selenium-Grid-Extras

Simplify the management of the Selenium Grid Nodes and stabilize said nodes by cleaning up the test environment after the build has been completed
Ruby
536
star
3

DotCi

DotCi Jenkins github integration, .ci.yml http://groupon.github.io/DotCi
Java
500
star
4

sparklint

A tool for monitoring and tuning Spark jobs for efficiency.
Scala
357
star
5

grox

Grox helps to maintain the state of Java / Android apps.
Java
339
star
6

testium

⛔️ [DEPRECATED] see https://github.com/testiumjs/testium-mocha
CoffeeScript
305
star
7

ansible-silo

Ansible in a self-contained environment via Docker.
Shell
203
star
8

ndu

node disk usage
JavaScript
194
star
9

odo

A Mock Proxy Server
Java
153
star
10

spark-metrics

A library to expose more of Apache Spark's metrics system
Scala
146
star
11

cson-parser

Simple & safe CSON parser
JavaScript
133
star
12

FeatureAdapter

FeatureAdapter (FA) is an Android Library providing an optimized way to display complex screens on Android.
Java
113
star
13

dependency-injection-checks

Dependency Injection Usage Checks
Java
97
star
14

node-cached

A simple caching library for node.js, inspired by the Play cache API
JavaScript
94
star
15

luigi-warehouse

A luigi powered analytics / warehouse stack
Python
87
star
16

gofer

A general purpose service client library for node.js
JavaScript
82
star
17

codeburner

Security-focused static code analysis for everyone
Ruby
81
star
18

locality-uuid.java

Java
80
star
19

jesos

Java
51
star
20

swagql

Create a GraphQL schema from swagger spec
JavaScript
45
star
21

quinn

A set of convenient helpers to use promises to handle http requests
JavaScript
40
star
22

robo-remote

RoboRemote is a remote control framework for Robotium. The goal of RoboRemote is to allow for more complex test scenarios by letting the automator write their tests using standard desktop Java/JUnit. All of the Robotium Solo commands are available. RoboRemote also provides some convencience classes to assist in common tasks such as interacting with list views.
Java
40
star
23

webdriver-http-sync

sync http implementation of the WebDriver protocol for Node.js
JavaScript
39
star
24

mysql_slowlogd

Daemon that serves MySQL's slow query log via HTTP as a streaming download
Shell
36
star
25

mongo-deep-mapreduce

Use Hadoop MapReduce directly on Mongo data
Java
30
star
26

tdsql

Run SQL queries against a Teradata data warehouse server
Perl
29
star
27

nlm

Lifecycle manager for node projects
JavaScript
29
star
28

monsoon

An extensible monitor system that checks java processes and exposes metrics based on them.
Java
28
star
29

backbeat

A workflow service for processing asynchronous tasks across distributed systems
Ruby
28
star
30

selenium-download

allow downloading of latest selenium standalone server and chromedriver
JavaScript
28
star
31

Message-Bus

Java
25
star
32

retromock

Like Wiremock for Retrofit, but faster.
Java
24
star
33

report-card

An Open Source Report Card
JavaScript
23
star
34

nakala

Java
22
star
35

assertive

Assertive is a terse yet expressive assertion library
JavaScript
21
star
36

locality-uuid.rb

Ruby
18
star
37

javascript

Guidelines for using Javascript at Groupon
JavaScript
16
star
38

KatMaps

Kotlin
16
star
39

shellot

Slim terminal realtime graphing tool
Ruby
14
star
40

roll

roll - bootstrap or upgrade a Unix host with Roller
C
13
star
41

sycl

Simple YAML Config Library
Ruby
13
star
42

vertx-utils

Java
12
star
43

baryon

Baryon is a library for building Spark Streaming applications that consume data from Kafka.
Scala
11
star
44

params_deserializers

Deserializers for Rails params
Ruby
11
star
45

poller

Poll a URL, and trigger code on changes
Ruby
10
star
46

git-workflow

JavaScript
10
star
47

json-schema-validator

Maven plugin to validate json files against a json schema. Uses https://github.com/fge/json-schema-validator library under the covers
Java
10
star
48

mysql-junit4

Java
9
star
49

vertx-memcache

Java
9
star
50

shared-store

Keeping config data in sync
JavaScript
9
star
51

artemisia

A light-weight configuration driven Data-Integration utility
Scala
8
star
52

pg_consul

C++
8
star
53

vertx-redis

Java
7
star
54

phy

Minimal hyperscript helpers for Preact
JavaScript
6
star
55

mezzanine

Mezzanine is a library built on Spark Streaming used to consume data from Kafka and store it into Hadoop.
Scala
6
star
56

DotCi-Plugins-Starter-Pack

DotCi-Plugins-Starter-Pack - Expansion-pack for DotCi
Java
6
star
57

Novie

Java
5
star
58

backbeat_ruby

A Ruby client for Backbeat workflow service
Ruby
4
star
59

gh-grep

GitHub CLI grep extension
TypeScript
4
star
60

nilo

A dependency injection toolset for building applications
JavaScript
3
star
61

promise

Java
3
star
62

schema-inferer

Scala
2
star
63

two-to-three

Swagger to Open API Converter
Java
2
star
64

assertive-as-promised

extends assertive with promise support
CoffeeScript
2
star
65

jtier-ctx

Java
2
star
66

kmond

Kotlin
2
star
67

api-build-resources

Build related resources files, e.g. checkstyle configs, etc.
2
star
68

tiquette

Have some etiquette. Format your commit messages with a ticket or issue number.
TypeScript
2
star
69

gofer-proxy

Use a `gofer` client as an express middleware
JavaScript
1
star
70

stylint-config-groupon

CSS
1
star
71

coffeelint-config-groupon

CoffeeScript lint setting used at Groupon
JavaScript
1
star
72

installed-package

Run your node tests against an installed version of your package
JavaScript
1
star
73

api-parent-pom

Project to contain parent pom for common plugin configuration across all API team Maven projects.
1
star
74

jdbi-st4

1
star
75

gh-bulk-pr

GitHub CLI bulk-pr extension
TypeScript
1
star