You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+187-9Lines changed: 187 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,38 +20,39 @@ After the plugin is installed, it can be enabled in your Gruntfile:
20
20
grunt.loadNpmTasks('grunt-postmark');
21
21
```
22
22
23
+
You'll need to add a [`config.json`](https://github.com/wildbit/mailmason/wiki/Getting-Started#create-configjson-required) and a [`secrets.json`](https://github.com/wildbit/mailmason/wiki/Getting-Started#create-secretsjson-optional) per the `mailmason` configuration.
24
+
23
25
## Postmark task
24
26
_Run this task with the `grunt postmark` command._
25
27
26
-
## Options
27
-
28
+
### Options
28
29
29
-
### serverToken
30
+
####serverToken
30
31
Your server token can be found on your server’s credentials page on [Postmark’s](http://postmarkapp.com) app.
31
32
32
33
Type: `String`
33
34
34
35
35
-
### from
36
+
####from
36
37
This is the from address you are using to send the email. This must be a confirmed address that's set up on [Postmark’s](http://postmarkapp.com) sender signatures.
37
38
38
39
Type: `String`
39
40
40
41
41
-
### to
42
+
####to
42
43
The address you’re sending to.
43
44
44
45
Type: `String`
45
46
46
47
47
-
### subject
48
+
####subject
48
49
49
50
Type: `String`
50
51
51
52
52
-
## Examples
53
+
###Examples
53
54
54
-
### Options specified through target
55
+
####Options specified through target
55
56
56
57
```javascript
57
58
grunt.initConfig({
@@ -67,7 +68,7 @@ grunt.initConfig({
67
68
});
68
69
```
69
70
70
-
### Specify options through targets or globally
71
+
####Specify options through targets or globally
71
72
Options specified through a target will always take precedence over global options.
72
73
73
74
```javascript
@@ -89,4 +90,181 @@ grunt.initConfig({
89
90
}
90
91
}
91
92
});
93
+
```
94
+
95
+
## Postmark templates task
96
+
_Run this task with the `grunt postmark-templates` command._
97
+
98
+
The `postmark-templates` task is an alias of the `postmark-templates-from-targets` task which is itself a two stepped task – `postmark-templates-upload` followed by `postmark-templates-output`.
99
+
100
+
`postmark-templates` (`postmark-templates-from-targets`) is intended for programmatic usage from other grunt tasks.
101
+
102
+
### `postmark-templates-upload` Targets
103
+
104
+
#### name
105
+
The name of your template.
106
+
107
+
Type: `String`
108
+
109
+
110
+
#### subject
111
+
The subject line of your template.
112
+
113
+
Type: `String`
114
+
115
+
#### htmlSrc
116
+
A path to the generated HTML for your template. *Not used if `htmlBody` is specified.*
117
+
118
+
Type: `String`
119
+
120
+
121
+
#### textSrc
122
+
A path to the generated plain text for your template. *Not used if `textBody` is specified.*
123
+
124
+
Type: `String`
125
+
126
+
#### htmlBody
127
+
The generated HTML content of your template. *Not required if `htmlSrc` is specified.*
128
+
129
+
Type: `String`
130
+
131
+
132
+
#### textBody
133
+
The generated plain text content of your template. *Not required if `textSrc` is specified.*
134
+
135
+
Type: `String`
136
+
137
+
138
+
### `postmark-templates-upload` Options
139
+
140
+
#### serverToken
141
+
Your server token can be found on your server’s credentials page on [Postmark’s](http://postmarkapp.com) app.
142
+
143
+
Type: `String`
144
+
145
+
146
+
#### ephemeralUploadResultsProperty
147
+
This is the name of a temporary grunt task configuration property used to communicate the upload results between `postmark-templates-upload` and `postmark-templates-output` without having to write a temporary file. **This should be the same value as `ephemeralUploadResultsProperty` for `postmark-templates-output`.**
148
+
149
+
Type: `String`
150
+
151
+
152
+
### `postmark-templates-output` Options
153
+
154
+
#### outputFile
155
+
The name of a file to output the results of the upload to Postmark.
156
+
157
+
Type: `String`
158
+
159
+
160
+
#### cleanOutput
161
+
If `true`, do not export `htmlBody`, `htmlSrc`, `textBody` or `textSrc` in the specified `outputFile`.
162
+
163
+
Type: `Boolean`
164
+
165
+
166
+
#### ephemeralUploadResultsProperty
167
+
This is the name of a temporary grunt task configuration property used to communicate the upload results between `postmark-templates-upload` and `postmark-templates-output` without having to write a temporary file. **This should be the same value as `ephemeralUploadResultsProperty` for `postmark-templates-upload`.**
_Run this task with the `grunt postmark-templates-from-file` command._
206
+
207
+
The `postmark-templates-from-file` task invokes the `postmark-templates` task with targets read from a JSON file (via `postmark-templates-parse`).
208
+
209
+
This task is intended for standalone, manual usage.
210
+
211
+
212
+
### `postmark-templates-parse` Options
213
+
214
+
#### inputFile
215
+
The name of a file that specifies templates for uploading to Postmark. These templates take the same shape as defined by `postmark-templates-upload`. This should usually be the same value as `outputFile` for `postmark-templates-output`.
216
+
217
+
Type: `String`
218
+
219
+
220
+
### Example
221
+
222
+
In your `Gruntfile`:
223
+
224
+
```javascript
225
+
grunt.initConfig({
226
+
'postmark-templates-parse': {
227
+
options: {
228
+
inputFile:'templates.json'
229
+
}
230
+
},
231
+
'postmark-templates-upload': {
232
+
options: {
233
+
serverToken:'POSTMARK_API_TEST',
234
+
ephemeralUploadResultsProperty:'temp'
235
+
}
236
+
},
237
+
'postmark-templates-output': {
238
+
options: {
239
+
cleanOutput:true,
240
+
outputFile:'templates.json',
241
+
ephemeralUploadResultsProperty:'temp'
242
+
}
243
+
}
244
+
});
245
+
```
246
+
247
+
In the file specified by `inputFile`, in this case, `templates.json`:
0 commit comments