Skip to content

Commit 445a7a4

Browse files
Add comments and styling cleanup
1 parent e1e9389 commit 445a7a4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tasks/grunt-postmark.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module.exports = function(grunt) {
99

1010
grunt.registerMultiTask('postmark', 'Send emails through Postmark', function() {
1111

12-
var done = this.async(),
13-
options = this.options(),
14-
_data = this.data;
12+
var done = this.async();
13+
var options = this.options();
14+
var _data = this.data;
1515

1616
// Check for server token
1717
if (!options.serverToken && !_data.serverToken) {
@@ -30,25 +30,28 @@ module.exports = function(grunt) {
3030
'Subject': _data.subject || options.subject
3131
};
3232

33-
// Send batch API request based off number of emails
33+
// If there are multiple source files
3434
if (this.filesSrc.length > 1) {
35-
// Send batch messages
3635
var messages = [];
3736

37+
// Iterate through each file
3838
this.filesSrc.forEach(function(path) {
39+
// Read the file and push it to messages array
3940
var obj = clone(message);
4041
obj.HtmlBody = grunt.file.read(path);
4142
messages.push(obj);
4243
});
4344

45+
// Send batch message
4446
client.sendEmailBatch(messages, function(err, response) {
4547
handleResponse(err, response, done);
4648
});
4749

4850
} else {
49-
// Send single message
51+
// Read file contents
5052
message.HtmlBody = grunt.file.read(this.filesSrc);
5153

54+
// Send single message
5255
client.sendEmail(message, function(err, response) {
5356
handleResponse(err, response, done);
5457
});

0 commit comments

Comments
 (0)