grunt-email-templates 
Email templates task
Getting Started
This plugin requires Grunt ~0.4.5
.
This task is encapsulation of node-email-templates.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-email-templates --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-email-templates');
The "email_templates" task
Overview
In your project's Gruntfile, add a section named email_templates
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
email_templates: {
your_target: {
'target/folder': 'source/folder'
},
},
});
Options
htmlFileName
Type: String
Default: html.html
Name of output file with html content.
txtFileName
Type: String
Default: text.txt
Name of output file with text content.
locals
Type: Object
Default: {}
Object with the variables used inside the templates.
Usage Examples
Default Options
In this example, the default options are used. Template from source/folder will be handled by emails-template and saved
in target/folder with file names html.html and text.txt.
grunt.initConfig({
email_templates: {
files: {
'target/folder': 'source/folder'
},
},
});
Custom filenames
Template from source/folder will be handled by emails-template and saved in target/folder with file names index.html and text.txt. Data inside the locals
object will also interpolate within the template (eg. <%= name %>
into Bobby).
grunt.initConfig({
email_templates: {
options: {
htmlFileName: 'index.html',
locals: {
name: 'Bobby'
}
},
files: {
'target/folder': 'source/folder'
},
},
});
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Changelog
0.2.0
0.1.1
- added options for name of files
0.1.0