This is a gulp-based workflow to create email templates for the Sunlight Foundation and various products/tools. Stable, ready-to-use templates live in the dist
directory of the master branch. Raw templates and partials live in src
.
#Install
- Clone this repo.
- Run
npm install
to install package dependencies. If npm isn't installed, follow these instructions to do so. - Run
npm install -g gulp
. - Run
gem install premailer
to install Premailer. (You'll need a compatible version of ruby installed for this. You might have to usesudo
also.) - Run
cp aws.json.example aws.json
#Development
- Run
gulp watch
. This will start a server and also watch for changes. The first time you run this task, it will create a build directory where local files will be served from. - In your browser, go to
localhost:3000/template/{template.html}
where {template.html} is the filename of the template you want to work on. - Edit files in the
src
directory to your liking. (You should be working on a new branch for each individual template, so that master always maintains clean, stable versions of templates.) - When you're ready to inline your template, run
gulp build
, followed bygulp publish
. This will build and inline your source files, and output them to thedist
directory. - Create a pull request to master when the template is tested and stable.
###Images
If you have any relative paths to images, gulp publish
will replace them with an absolute URL for you. If you need to update the location of these paths, configure the variables in /gulp/tasks/publish.js.
To upload images to AWS:
- Make sure you have valid S3 credentials in your aws.json file.
- Run
gulp build
to optimize all source images. - Run
gulp uploadImg
to push them to AWS. This will override existing images. (Asset fingerprinting is a to-do.)