@maizzle/framework 4.7.4 → 4.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/src/generators/output/to-disk.js +10 -6
- package/types/baseUrl.d.ts +79 -0
- package/types/build.d.ts +74 -0
- package/types/components.d.ts +177 -0
- package/types/config.d.ts +341 -0
- package/types/events.d.ts +105 -0
- package/types/expressions.d.ts +78 -0
- package/types/fetch.d.ts +143 -0
- package/types/index.d.ts +187 -0
- package/types/inlineCss.d.ts +207 -0
- package/types/layouts.d.ts +39 -0
- package/types/markdown.d.ts +31 -0
- package/types/minify.d.ts +136 -0
- package/types/plaintext.d.ts +62 -0
- package/types/posthtml.d.ts +195 -0
- package/types/removeUnusedCss.d.ts +115 -0
- package/types/render.d.ts +130 -0
- package/types/tailwind.d.ts +22 -0
- package/types/templates.d.ts +167 -0
- package/types/urlParameters.d.ts +39 -0
- package/types/widowWords.d.ts +56 -0
- package/src/index.d.ts +0 -2141
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import type BuildConfig from './build';
|
|
2
|
+
import type InlineCSSConfig from './inlineCss';
|
|
3
|
+
import type RemoveUnusedCSSConfig from './removeUnusedCss';
|
|
4
|
+
import type WidowWordsConfig from './widowWords';
|
|
5
|
+
import type BaseURLConfig from './baseURL';
|
|
6
|
+
import type URLParametersConfig from './urlParameters';
|
|
7
|
+
import type {CoreBeautifyOptions} from 'js-beautify';
|
|
8
|
+
import type MinifyConfig from './minify';
|
|
9
|
+
import type MarkdownConfig from './markdown';
|
|
10
|
+
import type EventsConfig from './events';
|
|
11
|
+
|
|
12
|
+
export default interface Config {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
Configure build settings.
|
|
17
|
+
|
|
18
|
+
@example
|
|
19
|
+
```
|
|
20
|
+
module.exports = {
|
|
21
|
+
build: {
|
|
22
|
+
templates: TemplatesConfig,
|
|
23
|
+
tailwind: TailwindConfig,
|
|
24
|
+
layouts: LayoutsConfig,
|
|
25
|
+
components: ComponentsConfig,
|
|
26
|
+
posthtml: PostHTMLConfig,
|
|
27
|
+
browsersync: BrowserSyncConfig,
|
|
28
|
+
fail: 'silent' // or 'verbose'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
*/
|
|
33
|
+
build: BuildConfig;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
Toggle the use of Transformers.
|
|
37
|
+
|
|
38
|
+
@default true
|
|
39
|
+
|
|
40
|
+
@example
|
|
41
|
+
```
|
|
42
|
+
module.exports = {
|
|
43
|
+
applyTransformers: false,
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
*/
|
|
47
|
+
applyTransformers?: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
Configure CSS inlining.
|
|
51
|
+
|
|
52
|
+
To enable it with defaults, simply set it to `true`.
|
|
53
|
+
@example
|
|
54
|
+
```js
|
|
55
|
+
module.exports = {
|
|
56
|
+
inlineCSS: true,
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
*/
|
|
60
|
+
inlineCSS?: boolean | InlineCSSConfig;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
Configure unused CSS purging.
|
|
64
|
+
|
|
65
|
+
To enable it with defaults, simply set it to `true`.
|
|
66
|
+
@example
|
|
67
|
+
```
|
|
68
|
+
module.exports = {
|
|
69
|
+
removeUnusedCSS: true,
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
*/
|
|
73
|
+
removeUnusedCSS?: boolean | RemoveUnusedCSSConfig;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
Automatically remove HTML attributes.
|
|
77
|
+
|
|
78
|
+
By default, empty `style` and `class` attributes are removed.
|
|
79
|
+
|
|
80
|
+
@default ['style', 'class']
|
|
81
|
+
|
|
82
|
+
@example
|
|
83
|
+
```
|
|
84
|
+
module.exports = {
|
|
85
|
+
removeAttributes: ['data-src']
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
*/
|
|
89
|
+
removeAttributes?:
|
|
90
|
+
| string[]
|
|
91
|
+
| Array<{
|
|
92
|
+
name: string;
|
|
93
|
+
value: string | RegExp;
|
|
94
|
+
}>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
Prevent widow words inside a tag by adding a ` ` between its last two words.
|
|
98
|
+
|
|
99
|
+
@example
|
|
100
|
+
```
|
|
101
|
+
module.exports = {
|
|
102
|
+
widowWords: true,
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
*/
|
|
106
|
+
widowWords?: WidowWordsConfig;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
[Add attributes](https://maizzle.com/docs/transformers/add-attributes) to elements in your HTML.
|
|
110
|
+
|
|
111
|
+
@default
|
|
112
|
+
{
|
|
113
|
+
table: {
|
|
114
|
+
cellpadding: 0,
|
|
115
|
+
cellspacing: 0,
|
|
116
|
+
role: 'none'
|
|
117
|
+
},
|
|
118
|
+
img: {
|
|
119
|
+
alt: ''
|
|
120
|
+
},
|
|
121
|
+
}
|
|
122
|
+
*/
|
|
123
|
+
extraAttributes?: boolean | Record<string, unknown>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
Normalize escaped character class names like `\:` or `\/` by replacing them with email-safe alternatives.
|
|
127
|
+
|
|
128
|
+
@example
|
|
129
|
+
```
|
|
130
|
+
module.exports = {
|
|
131
|
+
safeClassNames: {
|
|
132
|
+
':': '__',
|
|
133
|
+
'!': 'i-',
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
*/
|
|
138
|
+
safeClassNames?: boolean | Record<string, string>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
Rewrite longhand CSS inside style attributes with shorthand syntax.
|
|
142
|
+
Only works with margin, padding and border, and only when all sides are specified.
|
|
143
|
+
|
|
144
|
+
@default []
|
|
145
|
+
|
|
146
|
+
@example
|
|
147
|
+
```
|
|
148
|
+
module.exports = {
|
|
149
|
+
shorthandCSS: true, // or ['td', 'div'] to only apply to those tags
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
*/
|
|
153
|
+
shorthandCSS?: boolean | string[];
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
Define a string that will be prepended to sources and hrefs in your HTML and CSS.
|
|
157
|
+
|
|
158
|
+
@example
|
|
159
|
+
|
|
160
|
+
Prepend to all sources and hrefs:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
module.exports = {
|
|
164
|
+
baseURL: 'https://cdn.example.com/'
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Prepend only to `src` attributes on image tags:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
module.exports = {
|
|
172
|
+
baseURL: {
|
|
173
|
+
url: 'https://cdn.example.com/',
|
|
174
|
+
tags: ['img'],
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
*/
|
|
179
|
+
baseURL?: string | BaseURLConfig;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
Transform text inside elements marked with custom attributes.
|
|
183
|
+
|
|
184
|
+
Filters work only on elements that contain only text.
|
|
185
|
+
|
|
186
|
+
@default {}
|
|
187
|
+
|
|
188
|
+
@example
|
|
189
|
+
```
|
|
190
|
+
module.exports = {
|
|
191
|
+
filters: {
|
|
192
|
+
uppercase: str => str.toUpperCase()
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
*/
|
|
197
|
+
filters: Record<string, unknown>;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
Define variables outside of the `page` object.
|
|
201
|
+
|
|
202
|
+
@default {}
|
|
203
|
+
|
|
204
|
+
@example
|
|
205
|
+
```
|
|
206
|
+
module.exports = {
|
|
207
|
+
locals: {
|
|
208
|
+
company: {
|
|
209
|
+
name: 'Spacely Space Sprockets, Inc.'
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`company` can be then used like this:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
<p>{{ company.name }}</p>
|
|
219
|
+
```
|
|
220
|
+
*/
|
|
221
|
+
locals?: Record<string, unknown>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
Configure custom parameters to append to URLs.
|
|
225
|
+
|
|
226
|
+
@example
|
|
227
|
+
```
|
|
228
|
+
module.exports = {
|
|
229
|
+
urlParameters: {
|
|
230
|
+
_options: {
|
|
231
|
+
tags: ['a'],
|
|
232
|
+
qs: {}, // options for the `query-string` library
|
|
233
|
+
},
|
|
234
|
+
utm_source: 'maizzle',
|
|
235
|
+
utm_campaign: 'Campaign Name',
|
|
236
|
+
utm_medium: 'email',
|
|
237
|
+
custom_parameter: 'foo',
|
|
238
|
+
'1stOfApril': 'bar',
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
*/
|
|
243
|
+
urlParameters?: URLParametersConfig;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
Ensure that all your HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
|
|
247
|
+
|
|
248
|
+
@default true
|
|
249
|
+
|
|
250
|
+
@example
|
|
251
|
+
```
|
|
252
|
+
module.exports = {
|
|
253
|
+
sixHex: false,
|
|
254
|
+
}
|
|
255
|
+
```
|
|
256
|
+
*/
|
|
257
|
+
sixHex?: boolean;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
[Pretty print](https://maizzle.com/docs/transformers/prettify) your HTML email code so that it's nicely indented and more human-readable.
|
|
261
|
+
|
|
262
|
+
@default undefined
|
|
263
|
+
|
|
264
|
+
@example
|
|
265
|
+
```
|
|
266
|
+
module.exports = {
|
|
267
|
+
prettify: true,
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
*/
|
|
271
|
+
prettify?: boolean | CoreBeautifyOptions;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
Minify the compiled HTML email code.
|
|
275
|
+
|
|
276
|
+
@default false
|
|
277
|
+
|
|
278
|
+
@example
|
|
279
|
+
```
|
|
280
|
+
module.exports = {
|
|
281
|
+
minify: true,
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
*/
|
|
285
|
+
minify?: boolean | MinifyConfig;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
Configure the Markdown parser.
|
|
289
|
+
|
|
290
|
+
@example
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
module.exports = {
|
|
294
|
+
markdown: {
|
|
295
|
+
root: './', // A path relative to which markdown files are imported
|
|
296
|
+
encoding: 'utf8', // Encoding for imported Markdown files
|
|
297
|
+
markdownit: {}, // Options passed to markdown-it
|
|
298
|
+
plugins: [], // Plugins for markdown-it
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
*/
|
|
303
|
+
markdown?: MarkdownConfig;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
Batch-replace strings in your HTML.
|
|
307
|
+
|
|
308
|
+
@default {}
|
|
309
|
+
|
|
310
|
+
@example
|
|
311
|
+
```
|
|
312
|
+
module.exports = {
|
|
313
|
+
replaceStrings: {
|
|
314
|
+
'replace this exact string': 'with this one',
|
|
315
|
+
'\\s?data-src=""': '', // remove empty data-src="" attributes
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
*/
|
|
320
|
+
replaceStrings?: Record<string, string>;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
When compiling your email templates, Maizzle goes through a series of steps like generating a Template config, rendering, or applying Transformers.
|
|
324
|
+
You can hook into the build process and manipulate it by using functions that run before or after some of these steps.
|
|
325
|
+
|
|
326
|
+
@default {}
|
|
327
|
+
|
|
328
|
+
@example
|
|
329
|
+
```
|
|
330
|
+
module.exports = {
|
|
331
|
+
events: {
|
|
332
|
+
beforeRender: async (html, config) => {
|
|
333
|
+
// do something with html and config
|
|
334
|
+
return html;
|
|
335
|
+
},
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
*/
|
|
340
|
+
events?: EventsConfig;
|
|
341
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export type beforeCreateType = (config: any) => Promise<void>;
|
|
2
|
+
export type beforeRenderType = (html: string, config: any) => Promise<string>;
|
|
3
|
+
export type afterRenderType = (html: string, config: any) => Promise<string>;
|
|
4
|
+
export type afterTransformersType = (html: string, config: any) => Promise<string>;
|
|
5
|
+
export type afterBuildType = (files: any[], config: any) => Promise<void>;
|
|
6
|
+
|
|
7
|
+
export default interface EventsConfig {
|
|
8
|
+
/**
|
|
9
|
+
Runs after the Environment config has been computed, but before Templates are processed.
|
|
10
|
+
Exposes the `config` object so you can further customize it.
|
|
11
|
+
|
|
12
|
+
@default undefined
|
|
13
|
+
|
|
14
|
+
@example
|
|
15
|
+
```
|
|
16
|
+
module.exports = {
|
|
17
|
+
events: {
|
|
18
|
+
beforeCreate: async (config) => {
|
|
19
|
+
// do something with `config`
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
*/
|
|
25
|
+
beforeCreate: beforeCreateType;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
Runs after the Template's config has been computed, but just before it is compiled.
|
|
29
|
+
It exposes the Template's config, as well as the HTML. Must return the `html` string.
|
|
30
|
+
|
|
31
|
+
@default undefined
|
|
32
|
+
|
|
33
|
+
@example
|
|
34
|
+
```
|
|
35
|
+
module.exports = {
|
|
36
|
+
events: {
|
|
37
|
+
beforeRender: async (html, config) => {
|
|
38
|
+
// do something with html and config
|
|
39
|
+
return html;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
*/
|
|
45
|
+
beforeRender: beforeRenderType;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
Runs after the Template has been compiled, but before any Transformers have been applied.
|
|
49
|
+
Exposes the rendered `html` string and the `config`. Must return the `html` string.
|
|
50
|
+
|
|
51
|
+
@default undefined
|
|
52
|
+
|
|
53
|
+
@example
|
|
54
|
+
```
|
|
55
|
+
module.exports = {
|
|
56
|
+
events: {
|
|
57
|
+
afterRender: async (html, config) => {
|
|
58
|
+
// do something with html and config
|
|
59
|
+
return html;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
*/
|
|
65
|
+
afterRender: afterRenderType;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
Runs after all Transformers have been applied, just before the final HTML is returned.
|
|
69
|
+
Exposes the rendered `html` string and the `config`. Must return the `html` string.
|
|
70
|
+
|
|
71
|
+
@default undefined
|
|
72
|
+
|
|
73
|
+
@example
|
|
74
|
+
```
|
|
75
|
+
module.exports = {
|
|
76
|
+
events: {
|
|
77
|
+
afterTransformers: async (html, config) => {
|
|
78
|
+
// do something with html and config
|
|
79
|
+
return html;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
*/
|
|
85
|
+
afterTransformers: afterTransformersType;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
Runs after all Templates have been compiled and output to disk.
|
|
89
|
+
The files parameter will contain the paths to all the files inside the `build.templates.destination.path` directory.
|
|
90
|
+
|
|
91
|
+
@default undefined
|
|
92
|
+
|
|
93
|
+
@example
|
|
94
|
+
```
|
|
95
|
+
module.exports = {
|
|
96
|
+
events: {
|
|
97
|
+
afterBuild: async (files, config) => {
|
|
98
|
+
// do something with files or config
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
*/
|
|
104
|
+
afterBuild: afterBuildType;
|
|
105
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export default interface ExpressionsConfig {
|
|
2
|
+
/**
|
|
3
|
+
Define the starting and ending delimiters used for expressions.
|
|
4
|
+
|
|
5
|
+
@default ['{{', '}}']
|
|
6
|
+
*/
|
|
7
|
+
delimiters?: string[];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
Define the starting and ending delimiters used for unescaped expressions.
|
|
11
|
+
|
|
12
|
+
@default ['{{{', '}}}']
|
|
13
|
+
*/
|
|
14
|
+
unescapeDelimiters?: string[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
Object containing data that will be available under the `page` object.
|
|
18
|
+
|
|
19
|
+
@default {}
|
|
20
|
+
*/
|
|
21
|
+
locals?: Record<string, unknown>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
Attribute name for `<script>` tags that contain locals.
|
|
25
|
+
|
|
26
|
+
@default 'locals'
|
|
27
|
+
*/
|
|
28
|
+
localsAttr?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
Whether to remove `<script>` tags that contain locals.
|
|
32
|
+
|
|
33
|
+
@default false
|
|
34
|
+
*/
|
|
35
|
+
removeScriptLocals?: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
Tag names to be used for if/else statements.
|
|
39
|
+
|
|
40
|
+
@default ['if', 'elseif', 'else']
|
|
41
|
+
*/
|
|
42
|
+
conditionalTags?: string[];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
Tag names to be used for switch statements.
|
|
46
|
+
|
|
47
|
+
@default ['switch', 'case', 'default']
|
|
48
|
+
*/
|
|
49
|
+
switchTags?: string[];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
Tag names to be used for loops.
|
|
53
|
+
|
|
54
|
+
@default ['each', 'for']
|
|
55
|
+
*/
|
|
56
|
+
loopTags?: string[];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
Tag names to be used for scopes.
|
|
60
|
+
|
|
61
|
+
@default ['scope']
|
|
62
|
+
*/
|
|
63
|
+
scopeTags?: string[];
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Name of tag inside of which expression parsing is disabled.
|
|
67
|
+
|
|
68
|
+
@default 'raw'
|
|
69
|
+
*/
|
|
70
|
+
ignoredTag?: string;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
Enabling strict mode will throw an error if an expression cannot be evaluated.
|
|
74
|
+
|
|
75
|
+
@default false
|
|
76
|
+
*/
|
|
77
|
+
strictMode?: boolean;
|
|
78
|
+
}
|
package/types/fetch.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type {Options as GotOptions} from 'got';
|
|
2
|
+
import type ExpressionsConfig from './expressions';
|
|
3
|
+
|
|
4
|
+
export default interface PostHTMLFetchConfig {
|
|
5
|
+
/**
|
|
6
|
+
Supported tag names.
|
|
7
|
+
Only tags from this array will be processed by the plugin.
|
|
8
|
+
|
|
9
|
+
@default ['fetch', 'remote']
|
|
10
|
+
|
|
11
|
+
@example
|
|
12
|
+
```
|
|
13
|
+
module.exports = {
|
|
14
|
+
build: {
|
|
15
|
+
posthtml: {
|
|
16
|
+
fetch: {
|
|
17
|
+
tags: ['get']
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
*/
|
|
24
|
+
tags?: string[];
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
String representing the attribute name containing the URL to fetch.
|
|
28
|
+
|
|
29
|
+
@default 'url'
|
|
30
|
+
|
|
31
|
+
@example
|
|
32
|
+
```
|
|
33
|
+
module.exports = {
|
|
34
|
+
build: {
|
|
35
|
+
posthtml: {
|
|
36
|
+
fetch: {
|
|
37
|
+
attribute: 'from'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
*/
|
|
44
|
+
attribute?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
`posthtml-fetch` uses `got` to fetch data.
|
|
48
|
+
You can pass options directly to it, inside the `got` object.
|
|
49
|
+
|
|
50
|
+
@default {}
|
|
51
|
+
|
|
52
|
+
@example
|
|
53
|
+
```
|
|
54
|
+
module.exports = {
|
|
55
|
+
build: {
|
|
56
|
+
posthtml: {
|
|
57
|
+
got: {
|
|
58
|
+
prefixUrl: '...'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
*/
|
|
65
|
+
got?: GotOptions;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
When set to `true`, this option will preserve the `tag`, i.e. `<fetch>` around the response body.
|
|
69
|
+
|
|
70
|
+
@default false
|
|
71
|
+
|
|
72
|
+
@example
|
|
73
|
+
```
|
|
74
|
+
module.exports = {
|
|
75
|
+
build: {
|
|
76
|
+
posthtml: {
|
|
77
|
+
fetch: {
|
|
78
|
+
preserveTag: true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
*/
|
|
85
|
+
preserveTag?: boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
Pass options to `posthtml-expressions`.
|
|
89
|
+
|
|
90
|
+
@default {}
|
|
91
|
+
|
|
92
|
+
@example
|
|
93
|
+
```
|
|
94
|
+
module.exports = {
|
|
95
|
+
build: {
|
|
96
|
+
posthtml: {
|
|
97
|
+
fetch: {
|
|
98
|
+
expressions: {
|
|
99
|
+
delimiters: ['[[', ']]']
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
*/
|
|
107
|
+
expressions?: ExpressionsConfig;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
List of plugins that will be called after/before receiving and processing `locals`.
|
|
111
|
+
|
|
112
|
+
@default {}
|
|
113
|
+
|
|
114
|
+
@example
|
|
115
|
+
```
|
|
116
|
+
module.exports = {
|
|
117
|
+
build: {
|
|
118
|
+
posthtml: {
|
|
119
|
+
fetch: {
|
|
120
|
+
plugins: {
|
|
121
|
+
after(tree) {
|
|
122
|
+
// Your plugin implementation
|
|
123
|
+
},
|
|
124
|
+
before: [
|
|
125
|
+
tree => {
|
|
126
|
+
// Your plugin implementation
|
|
127
|
+
},
|
|
128
|
+
tree => {
|
|
129
|
+
// ..
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
*/
|
|
139
|
+
plugins?: {
|
|
140
|
+
after?: (tree: any) => void;
|
|
141
|
+
before?: Array<(tree: any) => void>;
|
|
142
|
+
};
|
|
143
|
+
}
|