• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 5 years ago

Reviews

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

Repository Details

HTML Email boilerplate generator for Yeoman

generator-htmlemail

A Yeoman generator to create HTML emails with built-in support for SCSS, image optimization, CSS inlining, test email delivery and more.

Based on Marco Solazzi's grunt-email-boilerplate.

Features

Requirements

  • Node.js >= 0.8.11 (install wiki)
  • Yeoman >= 1.0.0 (npm install -g yo)
  • Ruby >= 1.8.7 (installers)
  • Compass >= 0.12.2 (gem install compass)
  • Premailer >= 1.7.3 (gem install premailer and, most of the time, gem install hpricot)

Getting Started

To install generator-htmlemail from npm, run:

$ npm install -g generator-htmlemail

Then, initiate the generator in an empty directory with:

$ yo htmlemail

Documentation

Prompts

This generator will ask you a few questions about your project before scaffolding the file structure. Here's a summary of what each question is used for:

[?] What's the project name?

Used in the generated package.json file as the name of the project, by default this is the folder name.

[?] What template do you want to use?

Enter the URL of the boilerplate HTML file you want to use for your email, this can be the "raw" version of a github file or gist. Defaults to a modified version of HTML Email Boilerplate.

[?] What's your production domain?

Used by the premailer task to rewrite your assets url, e.g:

<img src="/img/sample.jpg" />

Becomes:

<img src="http://www.yourdomain.com/img/sample.jpg" />

[?] Select the SMTP host to use when sending test emails

Used to set up the nodemailer transport service.

[?] What's your SMTP server username and passsword?

Used to authenticate with the SMTP service.

[?] What's the name and email of the test email recipient?

The name and email address of the account where the test email will be sent.

Sources

Sources are located in the app folder:

  • index.html: HTML boilerplate
  • scss/: SCSS folder
    • style.scss: main stylesheet
  • img: source images of your email
  • css: destination folder of compiled SCSS sources

Default Tasks

The generator comes with some predefined tasks to cover average email development needs.

dev Task

This task runs a watch trigger for changes to the scss folder and starts a static HTTP server at http://localhost:8000 pointing to the app folder. The browser will reload automatically (thanks to the livereload task) upon changes to your SCSS or HTML files.

build Task

This task creates a build from your sources. It creates a folder named dist next to app, then compiles your SCSSes and inlines the resulting stylesheet in the HTML source through Premailer. Finally it starts a static HTTP server at http://localhost:8000 pointing to the dist folder.

Images are optimized with jpegtran and OptiPNG.

send Task

This task sends the compiled email to any configured recipient. This basically performs the same actions as the build task only that instead of running a static HTTP server it'll try to send the actual email.

Yeoman will ask you for your email transport settings and recipients on startup but if you wish to further customize these options refer to the nodemailer tasks in Gruntfile.js.

Docker

A standalone Dockerfile is included.

docker build -t htmlemail .
docker run -t -i htmlemail yo htmlemail

Tasks Customization

See Gruntfile.js source for more options and customizations.

Contributing

Feel free to submit bugs or pull requests, just make sure to target the develop branch and follow the same coding style.

License

MIT License

More Repositories

1

laravel-ember-todo

Sample todo application built with Laravel 4 and EmberJS
PHP
55
star
2

chatty

A simple chat app using Laravel, Pusher and AngularJS
JavaScript
23
star
3

post-category-filter

Filter post categories and taxonomies live in the WordPress admin area
PHP
18
star
4

FileUploadAttribute

Magento module that allows you to create file upload attributes to your products
PHP
18
star
5

magento2-new-order-notification

Display a notification in real time when a new order is created in Magento 2
CSS
14
star
6

magento2-copy-theme-override

Magento 2 command to automatically copy files into active theme
PHP
12
star
7

vsf-wishlist-button

Custom add to wishlist button with floating hearts animation
Vue
11
star
8

generator-magento-module

Yeoman generator for Magento 1 modules
JavaScript
10
star
9

upward-examples

Examples using Magento's UPWARD JS server
CSS
9
star
10

vue-storefront-instagram-feed

Instagram feed component for Vue Storefront
TypeScript
7
star
11

vsf-cms-block-mixin

Vue Storefront mixin to parse CMS blocks content as HTML elements
JavaScript
7
star
12

wp-starter-theme

Starter theme for WP Tuts+ optimization article
JavaScript
6
star
13

docker-imageoptim

Docker image to losslessly optimise all image formats
JavaScript
2
star
14

magento2-hyva-order-grid

PHP
2
star
15

generator-magento-extension-installer

Install Magento extensions from different sources
JavaScript
1
star
16

Jvs_ImageResize

Magento extension to resize cms images on upload
PHP
1
star
17

godot-sample

GDScript
1
star
18

vue-storefront-instagram-api

API Endpoint for Vue Storefront to fetch a user's Instagram feed
JavaScript
1
star