@maizzle/framework 4.8.7 → 5.0.0-beta.0
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/bin/maizzle +3 -1
- package/package.json +65 -58
- package/src/commands/build.js +244 -19
- package/src/commands/serve.js +2 -197
- package/src/generators/plaintext.js +192 -91
- package/src/generators/render.js +128 -0
- package/src/index.js +46 -14
- package/src/{generators/posthtml → posthtml}/defaultComponentsConfig.js +6 -4
- package/src/{generators/posthtml → posthtml}/defaultConfig.js +1 -1
- package/src/posthtml/index.js +74 -0
- package/src/posthtml/plugins/expandLinkTag.js +36 -0
- package/src/server/client.js +181 -0
- package/src/server/index.js +383 -0
- package/src/server/routes/hmr.js +24 -0
- package/src/server/routes/index.js +38 -0
- package/src/server/views/error.html +83 -0
- package/src/server/views/index.html +24 -0
- package/src/server/websockets.js +27 -0
- package/src/transformers/addAttributes.js +30 -0
- package/src/transformers/attributeToStyle.js +30 -36
- package/src/transformers/baseUrl.js +52 -23
- package/src/transformers/comb.js +51 -0
- package/src/transformers/core.js +20 -0
- package/src/transformers/filters/defaultFilters.js +90 -70
- package/src/transformers/filters/index.js +14 -78
- package/src/transformers/index.js +268 -63
- package/src/transformers/inline.js +240 -0
- package/src/transformers/markdown.js +13 -14
- package/src/transformers/minify.js +21 -16
- package/src/transformers/posthtmlMso.js +13 -8
- package/src/transformers/prettify.js +16 -15
- package/src/transformers/preventWidows.js +32 -26
- package/src/transformers/removeAttributes.js +17 -17
- package/src/transformers/replaceStrings.js +30 -9
- package/src/transformers/safeClassNames.js +24 -24
- package/src/transformers/shorthandCss.js +22 -0
- package/src/transformers/sixHex.js +15 -15
- package/src/transformers/urlParameters.js +18 -16
- package/src/transformers/useAttributeSizes.js +65 -0
- package/src/utils/getConfigByFilePath.js +124 -0
- package/src/utils/node.js +68 -0
- package/src/utils/string.js +117 -0
- package/types/build.d.ts +117 -57
- package/types/components.d.ts +130 -112
- package/types/config.d.ts +454 -242
- package/types/css/inline.d.ts +234 -0
- package/types/css/purge.d.ts +125 -0
- package/types/events.d.ts +5 -105
- package/types/index.d.ts +148 -116
- package/types/markdown.d.ts +20 -18
- package/types/minify.d.ts +122 -120
- package/types/plaintext.d.ts +46 -52
- package/types/posthtml.d.ts +103 -136
- package/types/render.d.ts +0 -117
- package/types/urlParameters.d.ts +21 -20
- package/types/widowWords.d.ts +9 -7
- package/src/functions/plaintext.js +0 -5
- package/src/functions/render.js +0 -5
- package/src/generators/config.js +0 -52
- package/src/generators/output/index.js +0 -4
- package/src/generators/output/to-disk.js +0 -254
- package/src/generators/output/to-string.js +0 -73
- package/src/generators/postcss.js +0 -23
- package/src/generators/posthtml/index.js +0 -75
- package/src/generators/tailwindcss.js +0 -157
- package/src/transformers/extraAttributes.js +0 -33
- package/src/transformers/inlineCss.js +0 -42
- package/src/transformers/removeInlineBackgroundColor.js +0 -56
- package/src/transformers/removeInlineSizes.js +0 -43
- package/src/transformers/removeInlinedSelectors.js +0 -100
- package/src/transformers/removeUnusedCss.js +0 -48
- package/src/transformers/shorthandInlineCSS.js +0 -26
- package/src/utils/helpers.js +0 -13
- package/types/baseUrl.d.ts +0 -79
- package/types/fetch.d.ts +0 -143
- package/types/inlineCss.d.ts +0 -207
- package/types/layouts.d.ts +0 -39
- package/types/removeUnusedCss.d.ts +0 -115
- package/types/tailwind.d.ts +0 -22
- package/types/templates.d.ts +0 -181
package/types/config.d.ts
CHANGED
|
@@ -1,31 +1,82 @@
|
|
|
1
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
2
|
import type MinifyConfig from './minify';
|
|
3
|
+
import type PostHTMLConfig from './posthtml';
|
|
9
4
|
import type MarkdownConfig from './markdown';
|
|
10
|
-
import type
|
|
5
|
+
import type { ProcessOptions } from 'postcss';
|
|
6
|
+
import type PurgeCSSConfig from './css/purge';
|
|
7
|
+
import type CSSInlineConfig from './css/inline';
|
|
8
|
+
import type ComponentsConfig from './components';
|
|
9
|
+
import type WidowWordsConfig from './widowWords';
|
|
10
|
+
import type { CoreBeautifyOptions } from 'js-beautify';
|
|
11
|
+
import type { BaseURLConfig } from 'posthtml-base-url';
|
|
12
|
+
import type URLParametersConfig from './urlParameters';
|
|
13
|
+
import type {
|
|
14
|
+
beforeCreateType,
|
|
15
|
+
beforeRenderType,
|
|
16
|
+
afterRenderType,
|
|
17
|
+
afterTransformersType,
|
|
18
|
+
afterBuildType
|
|
19
|
+
} from './events';
|
|
20
|
+
import type PlaintextConfig from './plaintext';
|
|
21
|
+
|
|
22
|
+
import type { Config as TailwindConfig } from 'tailwindcss';
|
|
11
23
|
|
|
12
24
|
export default interface Config {
|
|
13
|
-
[key: string]: any;
|
|
25
|
+
[key: string]: any; // eslint-disable-line
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Add or remove attributes from elements.
|
|
29
|
+
*/
|
|
30
|
+
attributes?: {
|
|
31
|
+
/**
|
|
32
|
+
* Add attributes to specific elements.
|
|
33
|
+
*
|
|
34
|
+
* @default {}
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```
|
|
38
|
+
* export default {
|
|
39
|
+
* attributes: {
|
|
40
|
+
* add: {
|
|
41
|
+
* table: {
|
|
42
|
+
* cellpadding: 0,
|
|
43
|
+
* cellspacing: 0,
|
|
44
|
+
* }
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
add?: Record<string, Record<string, string|number>>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Remove attributes from elements.
|
|
54
|
+
*
|
|
55
|
+
* @default {}
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```
|
|
59
|
+
* export default {
|
|
60
|
+
* attributes: {
|
|
61
|
+
* remove: ['width', 'height'],
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
remove?: Record<string, string[]>;
|
|
67
|
+
}
|
|
14
68
|
|
|
15
69
|
/**
|
|
16
70
|
Configure build settings.
|
|
17
71
|
|
|
18
72
|
@example
|
|
19
73
|
```
|
|
20
|
-
|
|
74
|
+
export default {
|
|
21
75
|
build: {
|
|
22
|
-
templates: TemplatesConfig,
|
|
23
|
-
tailwind: TailwindConfig,
|
|
24
|
-
layouts: LayoutsConfig,
|
|
25
76
|
components: ComponentsConfig,
|
|
26
77
|
posthtml: PostHTMLConfig,
|
|
27
|
-
|
|
28
|
-
|
|
78
|
+
tailwind: TailwindConfig,
|
|
79
|
+
templates: TemplatesConfig,
|
|
29
80
|
}
|
|
30
81
|
}
|
|
31
82
|
```
|
|
@@ -33,192 +84,327 @@ export default interface Config {
|
|
|
33
84
|
build: BuildConfig;
|
|
34
85
|
|
|
35
86
|
/**
|
|
36
|
-
|
|
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.
|
|
87
|
+
Define a string that will be prepended to sources and hrefs in your HTML and CSS.
|
|
51
88
|
|
|
52
|
-
To enable it with defaults, simply set it to `true`.
|
|
53
89
|
@example
|
|
54
|
-
```js
|
|
55
|
-
module.exports = {
|
|
56
|
-
inlineCSS: true,
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
*/
|
|
60
|
-
inlineCSS?: boolean | InlineCSSConfig;
|
|
61
90
|
|
|
62
|
-
|
|
63
|
-
Configure unused CSS purging.
|
|
91
|
+
Prepend to all sources and hrefs:
|
|
64
92
|
|
|
65
|
-
To enable it with defaults, simply set it to `true`.
|
|
66
|
-
@example
|
|
67
93
|
```
|
|
68
|
-
|
|
69
|
-
|
|
94
|
+
export default {
|
|
95
|
+
baseURL: 'https://cdn.example.com/'
|
|
70
96
|
}
|
|
71
97
|
```
|
|
72
|
-
*/
|
|
73
|
-
removeUnusedCSS?: boolean | RemoveUnusedCSSConfig;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
Automatically remove HTML attributes.
|
|
77
98
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
@default ['style', 'class']
|
|
99
|
+
Prepend only to `src` attributes on image tags:
|
|
81
100
|
|
|
82
|
-
@example
|
|
83
101
|
```
|
|
84
|
-
|
|
85
|
-
|
|
102
|
+
export default {
|
|
103
|
+
baseURL: {
|
|
104
|
+
url: 'https://cdn.example.com/',
|
|
105
|
+
tags: ['img'],
|
|
106
|
+
},
|
|
86
107
|
}
|
|
87
108
|
```
|
|
88
109
|
*/
|
|
89
|
-
|
|
90
|
-
| string[]
|
|
91
|
-
| Array<{
|
|
92
|
-
name: string;
|
|
93
|
-
value: string | RegExp;
|
|
94
|
-
}>;
|
|
110
|
+
baseURL?: string | BaseURLConfig;
|
|
95
111
|
|
|
96
112
|
/**
|
|
97
|
-
|
|
113
|
+
* Configure components.
|
|
114
|
+
*/
|
|
115
|
+
components?: ComponentsConfig;
|
|
98
116
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Configure how CSS is handled.
|
|
119
|
+
*/
|
|
120
|
+
css: {
|
|
121
|
+
/**
|
|
122
|
+
* Configure CSS inlining.
|
|
123
|
+
*/
|
|
124
|
+
inline?: CSSInlineConfig;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Configure CSS purging.
|
|
128
|
+
*/
|
|
129
|
+
purge?: PurgeCSSConfig;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Normalize escaped character class names like `\:` or `\/` by replacing them
|
|
133
|
+
* with email-safe alternatives.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```
|
|
137
|
+
* export default {
|
|
138
|
+
* css: {
|
|
139
|
+
* safeClassNames: {
|
|
140
|
+
* ':': '__',
|
|
141
|
+
* '!': 'i-',
|
|
142
|
+
* }
|
|
143
|
+
* }
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
safeClassNames?: boolean | Record<string, string>;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Ensure that all your HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
|
|
151
|
+
*
|
|
152
|
+
* @default true
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```
|
|
156
|
+
* export default {
|
|
157
|
+
* css: {
|
|
158
|
+
* sixHex: false,
|
|
159
|
+
* }
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
sixHex?: boolean;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Rewrite longhand CSS inside style attributes with shorthand syntax.
|
|
167
|
+
* Only works with `margin`, `padding` and `border`, and only when
|
|
168
|
+
* all sides are specified.
|
|
169
|
+
*
|
|
170
|
+
* @default []
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```
|
|
174
|
+
* export default {
|
|
175
|
+
* css: {
|
|
176
|
+
* shorthand: {
|
|
177
|
+
* tags: ['td', 'div'],
|
|
178
|
+
* } // or shorthand: true
|
|
179
|
+
* }
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
shorthand?: boolean | Record<string, string[]>;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Use a custom Tailwind CSS configuration object.
|
|
187
|
+
*
|
|
188
|
+
*/
|
|
189
|
+
tailwind?: TailwindConfig;
|
|
103
190
|
}
|
|
104
|
-
```
|
|
105
|
-
*/
|
|
106
|
-
widowWords?: WidowWordsConfig;
|
|
107
191
|
|
|
108
192
|
/**
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
193
|
+
* Transform text inside elements marked with custom attributes.
|
|
194
|
+
* Filters work only on elements that contain only text.
|
|
195
|
+
*
|
|
196
|
+
* @default {}
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```
|
|
200
|
+
* export default {
|
|
201
|
+
* filters: {
|
|
202
|
+
* uppercase: str => str.toUpperCase(),
|
|
203
|
+
* }
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
filters: boolean | Record<string, (str: string) => string>;
|
|
124
208
|
|
|
125
209
|
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
210
|
+
* Define variables outside of the `page` object.
|
|
211
|
+
*
|
|
212
|
+
* @default {}
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```
|
|
216
|
+
* export default {
|
|
217
|
+
* locals: {
|
|
218
|
+
* company: {
|
|
219
|
+
* name: 'Spacely Space Sprockets, Inc.'
|
|
220
|
+
* }
|
|
221
|
+
* }
|
|
222
|
+
* }
|
|
223
|
+
* ```
|
|
224
|
+
*
|
|
225
|
+
* `company` can then be used like this:
|
|
226
|
+
*
|
|
227
|
+
* ```
|
|
228
|
+
* <p>{{ company.name }}</p>
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
locals?: Record<string, any>; // eslint-disable-line
|
|
139
232
|
|
|
140
233
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
234
|
+
* Configure the Markdown parser.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
*
|
|
238
|
+
* ```
|
|
239
|
+
* export default {
|
|
240
|
+
* markdown: {
|
|
241
|
+
* root: './', // Path relative to which markdown files are imported
|
|
242
|
+
* encoding: 'utf8', // Encoding for imported Markdown files
|
|
243
|
+
* markdownit: {}, // Options passed to markdown-it
|
|
244
|
+
* plugins: [], // Plugins for markdown-it
|
|
245
|
+
* }
|
|
246
|
+
* }
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
markdown?: MarkdownConfig;
|
|
154
250
|
|
|
155
251
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
252
|
+
* Minify the compiled HTML email code.
|
|
253
|
+
*
|
|
254
|
+
* @default false
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```
|
|
258
|
+
* export default {
|
|
259
|
+
* minify: true,
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
minify?: boolean | MinifyConfig;
|
|
161
264
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
265
|
+
/**
|
|
266
|
+
Configure the `posthtml-mso` plugin.
|
|
267
|
+
*/
|
|
268
|
+
outlook?: {
|
|
269
|
+
/**
|
|
270
|
+
The tag name to use for Outlook conditional comments.
|
|
167
271
|
|
|
168
|
-
|
|
272
|
+
@default 'outlook'
|
|
169
273
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
274
|
+
@example
|
|
275
|
+
```
|
|
276
|
+
export default {
|
|
277
|
+
outlook: {
|
|
278
|
+
tag: 'mso'
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// You now write <mso>...</mso> instead of <outlook>...</outlook>
|
|
282
|
+
```
|
|
283
|
+
*/
|
|
284
|
+
tag?: string;
|
|
285
|
+
};
|
|
180
286
|
|
|
181
287
|
/**
|
|
182
|
-
|
|
288
|
+
* Configure plaintext generation.
|
|
289
|
+
*/
|
|
290
|
+
plaintext?: PlaintextConfig;
|
|
183
291
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
292
|
+
/**
|
|
293
|
+
* PostHTML configuration.
|
|
294
|
+
*/
|
|
295
|
+
posthtml?: PostHTMLConfig;
|
|
187
296
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
297
|
+
/**
|
|
298
|
+
* Configure PostCSS
|
|
299
|
+
*/
|
|
300
|
+
postcss?: {
|
|
301
|
+
/**
|
|
302
|
+
* Additional PostCSS plugins that you would like to use.
|
|
303
|
+
* @default []
|
|
304
|
+
* @example
|
|
305
|
+
* ```
|
|
306
|
+
* import examplePlugin from 'postcss-example-plugin'
|
|
307
|
+
* export default {
|
|
308
|
+
* postcss: {
|
|
309
|
+
* plugins: [
|
|
310
|
+
* examplePlugin()
|
|
311
|
+
* ]
|
|
312
|
+
* }
|
|
313
|
+
* }
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
plugins?: Array<() => void>;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* PostCSS options
|
|
320
|
+
* @default {}
|
|
321
|
+
* @example
|
|
322
|
+
* ```
|
|
323
|
+
* export default {
|
|
324
|
+
* postcss: {
|
|
325
|
+
* options: {
|
|
326
|
+
* map: true
|
|
327
|
+
* }
|
|
328
|
+
* }
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
options?: ProcessOptions;
|
|
332
|
+
};
|
|
198
333
|
|
|
199
334
|
/**
|
|
200
|
-
|
|
335
|
+
* [Pretty print](https://maizzle.com/docs/transformers/prettify) your HTML email code
|
|
336
|
+
* so that it's nicely indented and more human-readable.
|
|
337
|
+
*
|
|
338
|
+
* @default undefined
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```
|
|
342
|
+
* export default {
|
|
343
|
+
* prettify: true,
|
|
344
|
+
* }
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
prettify?: boolean | CoreBeautifyOptions;
|
|
201
348
|
|
|
202
|
-
|
|
349
|
+
/**
|
|
350
|
+
* Batch-replace strings in your HTML.
|
|
351
|
+
*
|
|
352
|
+
* @default {}
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```
|
|
356
|
+
* export default {
|
|
357
|
+
* replaceStrings: {
|
|
358
|
+
* 'replace this exact string': 'with this one',
|
|
359
|
+
* '\\s?data-src=""': '', // remove empty data-src="" attributes
|
|
360
|
+
* }
|
|
361
|
+
* }
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
replaceStrings?: Record<string, string>;
|
|
203
365
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
366
|
+
/**
|
|
367
|
+
* Configure local server settings.
|
|
368
|
+
*/
|
|
369
|
+
server?: {
|
|
370
|
+
/**
|
|
371
|
+
* Port to run the local server on.
|
|
372
|
+
*
|
|
373
|
+
* @default 3000
|
|
374
|
+
*/
|
|
375
|
+
port?: number;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Enable HMR-like local development.
|
|
379
|
+
* When enabled, Maizzle will watch for changes in your templates
|
|
380
|
+
* and inject them into the browser without a full page reload.
|
|
381
|
+
*
|
|
382
|
+
* @default true
|
|
383
|
+
*/
|
|
384
|
+
hmr?: boolean;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Enable synchronized scrolling across devices.
|
|
388
|
+
*
|
|
389
|
+
* @default false
|
|
390
|
+
*/
|
|
391
|
+
syncScroll?: boolean;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Paths to watch for changes.
|
|
395
|
+
* When a file in these paths changes, Maizzle will do a full rebuild.
|
|
396
|
+
*
|
|
397
|
+
* @default []
|
|
398
|
+
*/
|
|
399
|
+
watch?: string[];
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Toggle reporting compiled file size in the console.
|
|
403
|
+
*
|
|
404
|
+
* @default false
|
|
405
|
+
*/
|
|
406
|
+
reportFileSize?: boolean;
|
|
212
407
|
}
|
|
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
408
|
|
|
223
409
|
/**
|
|
224
410
|
Configure custom parameters to append to URLs.
|
|
@@ -243,99 +429,125 @@ export default interface Config {
|
|
|
243
429
|
urlParameters?: URLParametersConfig;
|
|
244
430
|
|
|
245
431
|
/**
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
432
|
+
* Enable or disable all Transformers.
|
|
433
|
+
*
|
|
434
|
+
* @default true
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```
|
|
438
|
+
* export default {
|
|
439
|
+
* useTransformers: false,
|
|
440
|
+
* }
|
|
441
|
+
* ```
|
|
256
442
|
*/
|
|
257
|
-
|
|
443
|
+
useTransformers?: boolean;
|
|
258
444
|
|
|
259
445
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
446
|
+
* Prevent widow words inside a tag by adding a ` ` between its last two words.
|
|
447
|
+
*
|
|
448
|
+
* @default
|
|
449
|
+
* {
|
|
450
|
+
* minWordCount: 3,
|
|
451
|
+
* attrName: 'prevent-widows'
|
|
452
|
+
* }
|
|
453
|
+
*
|
|
454
|
+
* @example
|
|
455
|
+
* ```
|
|
456
|
+
* export default {
|
|
457
|
+
* widowWords: {
|
|
458
|
+
* minWordCount: 5,
|
|
459
|
+
* },
|
|
460
|
+
* }
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
widowWords?: WidowWordsConfig;
|
|
272
464
|
|
|
273
465
|
/**
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
466
|
+
* Runs after the Environment config has been computed, but before Templates are processed.
|
|
467
|
+
* Exposes the `config` object so you can further customize it.
|
|
468
|
+
*
|
|
469
|
+
* @default undefined
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```
|
|
473
|
+
* export default {
|
|
474
|
+
* beforeCreate: async (config) => {
|
|
475
|
+
* // do something with `config`
|
|
476
|
+
* }
|
|
477
|
+
* }
|
|
478
|
+
* ```
|
|
284
479
|
*/
|
|
285
|
-
|
|
480
|
+
beforeCreate: beforeCreateType;
|
|
286
481
|
|
|
287
482
|
/**
|
|
288
|
-
|
|
483
|
+
* Runs after the Template's config has been computed, but just before it is compiled.
|
|
484
|
+
* It exposes the Template's HTML, its config, and the Maizzle `render` function.
|
|
485
|
+
* Must return the `html` string.
|
|
486
|
+
*
|
|
487
|
+
* @default undefined
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```
|
|
491
|
+
* export default {
|
|
492
|
+
* beforeRender: async ({html, config, render}) => {
|
|
493
|
+
* // do something...
|
|
494
|
+
* return html;
|
|
495
|
+
* }
|
|
496
|
+
* }
|
|
497
|
+
* ```
|
|
498
|
+
*/
|
|
499
|
+
beforeRender: beforeRenderType;
|
|
289
500
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
501
|
+
/**
|
|
502
|
+
* Runs after the Template has been compiled, but before any Transformers have been applied.
|
|
503
|
+
* Exposes the rendered `html` string and the `config`. Must return the `html` string.
|
|
504
|
+
*
|
|
505
|
+
* @default undefined
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```
|
|
509
|
+
* export default {
|
|
510
|
+
* afterRender: async ({html, config}) => {
|
|
511
|
+
* // do something...
|
|
512
|
+
* return html;
|
|
513
|
+
* }
|
|
514
|
+
* }
|
|
515
|
+
* ```
|
|
302
516
|
*/
|
|
303
|
-
|
|
517
|
+
afterRender: afterRenderType;
|
|
304
518
|
|
|
305
519
|
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
|
|
520
|
+
* Runs after all Transformers have been applied, just before the final HTML is returned.
|
|
521
|
+
* Exposes the rendered `html` string and the `config`. Must return the `html` string.
|
|
522
|
+
*
|
|
523
|
+
* @default undefined
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```
|
|
527
|
+
* export default {
|
|
528
|
+
* afterTransformers: async ({html, config, render}) => {
|
|
529
|
+
* // do something...
|
|
530
|
+
* return html;
|
|
531
|
+
* }
|
|
532
|
+
* }
|
|
533
|
+
* ```
|
|
319
534
|
*/
|
|
320
|
-
|
|
535
|
+
afterTransformers: afterTransformersType;
|
|
321
536
|
|
|
322
537
|
/**
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
@default
|
|
327
|
-
|
|
328
|
-
@example
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
```
|
|
538
|
+
* Runs after all Templates have been compiled and output to disk.
|
|
539
|
+
* The files parameter will contain the paths to all the files inside the `build.templates.destination.path` directory.
|
|
540
|
+
*
|
|
541
|
+
* @default undefined
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```
|
|
545
|
+
* export default {
|
|
546
|
+
* afterBuild: async ({files, config, render}) => {
|
|
547
|
+
* // do something...
|
|
548
|
+
* }
|
|
549
|
+
* }
|
|
550
|
+
* ```
|
|
339
551
|
*/
|
|
340
|
-
|
|
552
|
+
afterBuild: afterBuildType;
|
|
341
553
|
}
|