@maizzle/framework 5.0.0-beta.9 → 5.0.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/package.json +31 -29
- package/src/commands/build.js +106 -30
- package/src/generators/plaintext.js +22 -18
- package/src/generators/render.js +16 -18
- package/src/index.js +3 -3
- package/src/posthtml/defaultComponentsConfig.js +10 -2
- package/src/posthtml/defaultConfig.js +13 -3
- package/src/posthtml/index.js +59 -14
- package/src/server/index.js +171 -98
- package/src/server/routes/index.js +51 -13
- package/src/server/views/404.html +59 -0
- package/src/server/views/index.html +162 -14
- package/src/transformers/addAttributes.js +2 -3
- package/src/transformers/attributeToStyle.js +1 -3
- package/src/transformers/baseUrl.js +6 -6
- package/src/transformers/filters/index.js +1 -2
- package/src/transformers/index.js +57 -95
- package/src/transformers/inline.js +44 -48
- package/src/transformers/markdown.js +14 -7
- package/src/transformers/minify.js +4 -3
- package/src/transformers/posthtmlMso.js +1 -3
- package/src/transformers/prettify.js +4 -3
- package/src/transformers/preventWidows.js +15 -65
- package/src/transformers/{comb.js → purge.js} +9 -8
- package/src/transformers/removeAttributes.js +3 -4
- package/src/transformers/replaceStrings.js +7 -5
- package/src/transformers/safeClassNames.js +1 -2
- package/src/transformers/shorthandCss.js +1 -3
- package/src/transformers/sixHex.js +1 -3
- package/src/transformers/template.js +9 -9
- package/src/transformers/urlParameters.js +1 -3
- package/src/transformers/useAttributeSizes.js +1 -3
- package/src/utils/getConfigByFilePath.js +10 -0
- package/src/utils/node.js +0 -23
- package/src/utils/string.js +34 -12
- package/types/build.d.ts +51 -28
- package/types/config.d.ts +127 -64
- package/types/css/inline.d.ts +10 -26
- package/types/css/purge.d.ts +3 -3
- package/types/events.d.ts +153 -5
- package/types/index.d.ts +4 -3
- package/types/posthtml.d.ts +3 -3
- package/types/urlParameters.d.ts +1 -1
- package/types/widowWords.d.ts +16 -36
- package/types/components.d.ts +0 -195
- package/types/expressions.d.ts +0 -100
package/src/utils/string.js
CHANGED
|
@@ -117,22 +117,34 @@ export function humanFileSize(bytes, si=false, dp=2) {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
* Get the root directories from a list of
|
|
121
|
-
*
|
|
122
|
-
* @
|
|
120
|
+
* Get the root directories from a list of glob patterns.
|
|
121
|
+
*
|
|
122
|
+
* @param {array} patterns List of glob patterns.
|
|
123
|
+
* @returns {array} List of root directories.
|
|
123
124
|
*/
|
|
124
|
-
export function getRootDirectories(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const rootDirs = new Set()
|
|
125
|
+
export function getRootDirectories(patterns = []) {
|
|
126
|
+
if (!Array.isArray(patterns)) {
|
|
127
|
+
return []
|
|
128
|
+
}
|
|
130
129
|
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
if (patterns.length === 0) {
|
|
131
|
+
return []
|
|
133
132
|
}
|
|
134
133
|
|
|
135
|
-
return
|
|
134
|
+
return [...new Set(
|
|
135
|
+
patterns
|
|
136
|
+
.filter(pattern => !pattern.startsWith('!'))
|
|
137
|
+
.map(pattern => {
|
|
138
|
+
// If the pattern doesn't include wildcards, use it as is
|
|
139
|
+
if (!pattern.includes('*')) {
|
|
140
|
+
return pattern.replace(/\/$/, '') // Remove trailing slash if present
|
|
141
|
+
}
|
|
142
|
+
// For patterns with wildcards, get the part before the first wildcard
|
|
143
|
+
const parts = pattern.split(/[*{]/)[0].split('/')
|
|
144
|
+
return parts.slice(0, -1).join('/')
|
|
145
|
+
})
|
|
146
|
+
.filter(Boolean)
|
|
147
|
+
)]
|
|
136
148
|
}
|
|
137
149
|
|
|
138
150
|
/**
|
|
@@ -182,3 +194,13 @@ export function parseCSSRule(rule) {
|
|
|
182
194
|
|
|
183
195
|
return { property, value }
|
|
184
196
|
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Normalize a string by removing extra whitespace.
|
|
200
|
+
*
|
|
201
|
+
* @param {String} str The string to clean
|
|
202
|
+
* @returns {String} The cleaned string
|
|
203
|
+
*/
|
|
204
|
+
export function cleanString(str) {
|
|
205
|
+
return str.replace(/\s+/g, ' ').trim()
|
|
206
|
+
}
|
package/types/build.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import ComponentsConfig from './components';
|
|
2
1
|
import type { SpinnerName } from 'cli-spinners';
|
|
3
|
-
import type ExpressionsConfig from './expressions';
|
|
4
2
|
|
|
5
3
|
export default interface BuildConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Components configuration.
|
|
8
|
-
*/
|
|
9
|
-
components?: ComponentsConfig;
|
|
10
|
-
|
|
11
4
|
/**
|
|
12
5
|
* Paths where Maizzle should look for Templates to compile.
|
|
13
6
|
*
|
|
@@ -22,12 +15,7 @@ export default interface BuildConfig {
|
|
|
22
15
|
* }
|
|
23
16
|
* ```
|
|
24
17
|
*/
|
|
25
|
-
content?: string
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
Configure expressions.
|
|
29
|
-
*/
|
|
30
|
-
expressions?: ExpressionsConfig;
|
|
18
|
+
content?: string[];
|
|
31
19
|
|
|
32
20
|
/**
|
|
33
21
|
* Define the output path for compiled Templates, and what file extension they should use.
|
|
@@ -57,6 +45,29 @@ export default interface BuildConfig {
|
|
|
57
45
|
* @default 'html'
|
|
58
46
|
*/
|
|
59
47
|
extension: string;
|
|
48
|
+
/**
|
|
49
|
+
* Path or array of paths that will be unwrapped.
|
|
50
|
+
* Everything inside them will be copied to
|
|
51
|
+
* the root of the output directory.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
*
|
|
55
|
+
* ```
|
|
56
|
+
* export default {
|
|
57
|
+
* build: {
|
|
58
|
+
* content: ['test/fixtures/**\/*.html'],
|
|
59
|
+
* output: {
|
|
60
|
+
* from: ['test/fixtures'],
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*
|
|
65
|
+
* This will copy everything inside `test/fixtures` to the root
|
|
66
|
+
* of the output directory, not creating the `test/fixtures`
|
|
67
|
+
* directory.
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
from: string;
|
|
60
71
|
};
|
|
61
72
|
|
|
62
73
|
/**
|
|
@@ -88,21 +99,6 @@ export default interface BuildConfig {
|
|
|
88
99
|
* @default undefined
|
|
89
100
|
*/
|
|
90
101
|
destination?: string;
|
|
91
|
-
} | {
|
|
92
|
-
/**
|
|
93
|
-
* An array of objects specifying source and destination directories for static files.
|
|
94
|
-
*/
|
|
95
|
-
static: Array<{
|
|
96
|
-
/**
|
|
97
|
-
* Array of paths where Maizzle should look for static files.
|
|
98
|
-
*/
|
|
99
|
-
source: string[];
|
|
100
|
-
/**
|
|
101
|
-
* Directory where static files should be copied to,
|
|
102
|
-
* relative to the `build.output` path.
|
|
103
|
-
*/
|
|
104
|
-
destination: string;
|
|
105
|
-
}>;
|
|
106
102
|
};
|
|
107
103
|
|
|
108
104
|
/**
|
|
@@ -137,4 +133,31 @@ export default interface BuildConfig {
|
|
|
137
133
|
* ```
|
|
138
134
|
*/
|
|
139
135
|
summary?: boolean;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Information about the Template currently being compiled.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
*
|
|
142
|
+
* ```
|
|
143
|
+
* {
|
|
144
|
+
path: {
|
|
145
|
+
root: 'build_production',
|
|
146
|
+
dir: 'build_production',
|
|
147
|
+
base: 'transactional.html',
|
|
148
|
+
ext: '.html',
|
|
149
|
+
name: 'transactional'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
current?: {
|
|
155
|
+
path?: {
|
|
156
|
+
root: string;
|
|
157
|
+
dir: string;
|
|
158
|
+
base: string;
|
|
159
|
+
ext: string;
|
|
160
|
+
name: string;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
140
163
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
1
|
+
import type Events from './events';
|
|
1
2
|
import type BuildConfig from './build';
|
|
2
3
|
import type MinifyConfig from './minify';
|
|
3
4
|
import type PostHTMLConfig from './posthtml';
|
|
4
5
|
import type MarkdownConfig from './markdown';
|
|
5
6
|
import type { ProcessOptions } from 'postcss';
|
|
6
7
|
import type PurgeCSSConfig from './css/purge';
|
|
8
|
+
import type PlaintextConfig from './plaintext';
|
|
7
9
|
import type CSSInlineConfig from './css/inline';
|
|
8
|
-
import type
|
|
10
|
+
import type { SpinnerName } from 'cli-spinners';
|
|
9
11
|
import type WidowWordsConfig from './widowWords';
|
|
10
12
|
import type { CoreBeautifyOptions } from 'js-beautify';
|
|
11
13
|
import type { BaseURLConfig } from 'posthtml-base-url';
|
|
12
14
|
import type URLParametersConfig from './urlParameters';
|
|
13
|
-
import type {
|
|
14
|
-
|
|
15
|
-
beforeRenderType,
|
|
16
|
-
afterRenderType,
|
|
17
|
-
afterTransformersType,
|
|
18
|
-
afterBuildType
|
|
19
|
-
} from './events';
|
|
20
|
-
import type PlaintextConfig from './plaintext';
|
|
21
|
-
|
|
15
|
+
import type { PostCssCalcOptions } from 'postcss-calc';
|
|
16
|
+
import type { PostHTMLFetchConfig } from 'posthtml-fetch';
|
|
22
17
|
import type { Config as TailwindConfig } from 'tailwindcss';
|
|
18
|
+
import type { PostHTMLComponents } from 'posthtml-component';
|
|
19
|
+
import type { PostHTMLExpressions } from 'posthtml-expressions';
|
|
23
20
|
|
|
24
21
|
export default interface Config {
|
|
25
|
-
[key: string]: any; // eslint-disable-line
|
|
26
|
-
|
|
27
22
|
/**
|
|
28
23
|
* Add or remove attributes from elements.
|
|
29
24
|
*/
|
|
@@ -47,7 +42,7 @@ export default interface Config {
|
|
|
47
42
|
* }
|
|
48
43
|
* ```
|
|
49
44
|
*/
|
|
50
|
-
add?: Record<string, Record<string, string|number>>;
|
|
45
|
+
add?: Record<string, Record<string, string | number>>;
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
48
|
* Remove attributes from elements.
|
|
@@ -58,30 +53,23 @@ export default interface Config {
|
|
|
58
53
|
* ```
|
|
59
54
|
* export default {
|
|
60
55
|
* attributes: {
|
|
61
|
-
* remove: [
|
|
56
|
+
* remove: [
|
|
57
|
+
* {
|
|
58
|
+
* name: 'width',
|
|
59
|
+
* value: '100', // or RegExp: /\d/
|
|
60
|
+
* },
|
|
61
|
+
* ], // or as array: ['width', 'height']
|
|
62
62
|
* }
|
|
63
63
|
* }
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
remove?:
|
|
66
|
+
remove?: Array<string | { name: string; value: string | RegExp }>;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
export default {
|
|
75
|
-
build: {
|
|
76
|
-
components: ComponentsConfig,
|
|
77
|
-
posthtml: PostHTMLConfig,
|
|
78
|
-
tailwind: TailwindConfig,
|
|
79
|
-
templates: TemplatesConfig,
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
*/
|
|
84
|
-
build: BuildConfig;
|
|
70
|
+
* Configure build settings.
|
|
71
|
+
*/
|
|
72
|
+
build?: BuildConfig;
|
|
85
73
|
|
|
86
74
|
/**
|
|
87
75
|
Define a string that will be prepended to sources and hrefs in your HTML and CSS.
|
|
@@ -112,12 +100,12 @@ export default interface Config {
|
|
|
112
100
|
/**
|
|
113
101
|
* Configure components.
|
|
114
102
|
*/
|
|
115
|
-
components?:
|
|
103
|
+
components?: PostHTMLComponents;
|
|
116
104
|
|
|
117
105
|
/**
|
|
118
106
|
* Configure how CSS is handled.
|
|
119
107
|
*/
|
|
120
|
-
css
|
|
108
|
+
css?: {
|
|
121
109
|
/**
|
|
122
110
|
* Configure CSS inlining.
|
|
123
111
|
*/
|
|
@@ -128,6 +116,52 @@ export default interface Config {
|
|
|
128
116
|
*/
|
|
129
117
|
purge?: PurgeCSSConfig;
|
|
130
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Resolve CSS `calc()` expressions to their static values.
|
|
121
|
+
*/
|
|
122
|
+
resolveCalc?: boolean | PostCssCalcOptions;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Resolve CSS custom properties to their static values.
|
|
126
|
+
*/
|
|
127
|
+
resolveProps?: boolean | {
|
|
128
|
+
/**
|
|
129
|
+
* Whether to preserve custom properties in the output.
|
|
130
|
+
*
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
133
|
+
preserve?: boolean | 'computed';
|
|
134
|
+
/**
|
|
135
|
+
* Define CSS variables that will be added to :root.
|
|
136
|
+
*
|
|
137
|
+
* @default {}
|
|
138
|
+
*/
|
|
139
|
+
variables?: {
|
|
140
|
+
[key: string]: string | {
|
|
141
|
+
/**
|
|
142
|
+
* The value of the CSS variable.
|
|
143
|
+
*/
|
|
144
|
+
value: string;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the variable is !important.
|
|
147
|
+
*/
|
|
148
|
+
isImportant?: boolean;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Whether to preserve variables injected via JS with the `variables` option.
|
|
153
|
+
*
|
|
154
|
+
* @default true
|
|
155
|
+
*/
|
|
156
|
+
preserveInjectedVariables?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Whether to preserve `@media` rules order.
|
|
159
|
+
*
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
preserveAtRulesOrder?: boolean;
|
|
163
|
+
};
|
|
164
|
+
|
|
131
165
|
/**
|
|
132
166
|
* Normalize escaped character class names like `\:` or `\/` by replacing them
|
|
133
167
|
* with email-safe alternatives.
|
|
@@ -147,48 +181,57 @@ export default interface Config {
|
|
|
147
181
|
safe?: boolean | Record<string, string>;
|
|
148
182
|
|
|
149
183
|
/**
|
|
150
|
-
*
|
|
184
|
+
* Rewrite longhand CSS inside style attributes with shorthand syntax.
|
|
185
|
+
* Only works with `margin`, `padding` and `border`, and only when
|
|
186
|
+
* all sides are specified.
|
|
151
187
|
*
|
|
152
|
-
* @default
|
|
188
|
+
* @default []
|
|
153
189
|
*
|
|
154
190
|
* @example
|
|
155
191
|
* ```
|
|
156
192
|
* export default {
|
|
157
193
|
* css: {
|
|
158
|
-
*
|
|
194
|
+
* shorthand: {
|
|
195
|
+
* tags: ['td', 'div'],
|
|
196
|
+
* } // or shorthand: true
|
|
159
197
|
* }
|
|
160
198
|
* }
|
|
161
199
|
* ```
|
|
162
200
|
*/
|
|
163
|
-
|
|
201
|
+
shorthand?: boolean | Record<string, string[]>;
|
|
164
202
|
|
|
165
203
|
/**
|
|
166
|
-
*
|
|
167
|
-
* Only works with `margin`, `padding` and `border`, and only when
|
|
168
|
-
* all sides are specified.
|
|
204
|
+
* Ensure that all your HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
|
|
169
205
|
*
|
|
170
|
-
* @default
|
|
206
|
+
* @default true
|
|
171
207
|
*
|
|
172
208
|
* @example
|
|
173
209
|
* ```
|
|
174
210
|
* export default {
|
|
175
211
|
* css: {
|
|
176
|
-
*
|
|
177
|
-
* tags: ['td', 'div'],
|
|
178
|
-
* } // or shorthand: true
|
|
212
|
+
* sixHex: false,
|
|
179
213
|
* }
|
|
180
214
|
* }
|
|
181
215
|
* ```
|
|
182
216
|
*/
|
|
183
|
-
|
|
217
|
+
sixHex?: boolean;
|
|
184
218
|
|
|
185
219
|
/**
|
|
186
220
|
* Use a custom Tailwind CSS configuration object.
|
|
187
|
-
*
|
|
188
221
|
*/
|
|
189
222
|
tailwind?: TailwindConfig;
|
|
190
223
|
}
|
|
191
224
|
|
|
225
|
+
/**
|
|
226
|
+
Configure [posthtml-expressions](https://github.com/posthtml/posthtml-expressions) options.
|
|
227
|
+
*/
|
|
228
|
+
expressions?: PostHTMLExpressions;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Configure the [`<fetch>`](https://maizzle.com/docs/tags#fetch) tag.
|
|
232
|
+
*/
|
|
233
|
+
fetch?: PostHTMLFetchConfig;
|
|
234
|
+
|
|
192
235
|
/**
|
|
193
236
|
* Transform text inside elements marked with custom attributes.
|
|
194
237
|
* Filters work only on elements that contain only text.
|
|
@@ -204,7 +247,7 @@ export default interface Config {
|
|
|
204
247
|
* }
|
|
205
248
|
* ```
|
|
206
249
|
*/
|
|
207
|
-
filters
|
|
250
|
+
filters?: boolean | Record<string, (str: string) => string>;
|
|
208
251
|
|
|
209
252
|
/**
|
|
210
253
|
* Define variables outside of the `page` object.
|
|
@@ -228,7 +271,7 @@ export default interface Config {
|
|
|
228
271
|
* <p>{{ company.name }}</p>
|
|
229
272
|
* ```
|
|
230
273
|
*/
|
|
231
|
-
locals?: Record<string, any>;
|
|
274
|
+
locals?: Record<string, any>;
|
|
232
275
|
|
|
233
276
|
/**
|
|
234
277
|
* Configure the Markdown parser.
|
|
@@ -384,11 +427,11 @@ export default interface Config {
|
|
|
384
427
|
hmr?: boolean;
|
|
385
428
|
|
|
386
429
|
/**
|
|
387
|
-
* Enable synchronized scrolling across
|
|
430
|
+
* Enable synchronized scrolling across browser tabs.
|
|
388
431
|
*
|
|
389
432
|
* @default false
|
|
390
433
|
*/
|
|
391
|
-
|
|
434
|
+
scrollSync?: boolean;
|
|
392
435
|
|
|
393
436
|
/**
|
|
394
437
|
* Paths to watch for changes.
|
|
@@ -404,6 +447,22 @@ export default interface Config {
|
|
|
404
447
|
* @default false
|
|
405
448
|
*/
|
|
406
449
|
reportFileSize?: boolean;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Type of spinner to show in the console.
|
|
453
|
+
*
|
|
454
|
+
* @default 'circleHalves'
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```
|
|
458
|
+
* export default {
|
|
459
|
+
* server: {
|
|
460
|
+
* spinner: 'bounce'
|
|
461
|
+
* }
|
|
462
|
+
* }
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
spinner?: SpinnerName;
|
|
407
466
|
}
|
|
408
467
|
|
|
409
468
|
/**
|
|
@@ -471,83 +530,87 @@ export default interface Config {
|
|
|
471
530
|
* @example
|
|
472
531
|
* ```
|
|
473
532
|
* export default {
|
|
474
|
-
* beforeCreate: async (config) => {
|
|
533
|
+
* beforeCreate: async ({config}) => {
|
|
475
534
|
* // do something with `config`
|
|
476
535
|
* }
|
|
477
536
|
* }
|
|
478
537
|
* ```
|
|
479
538
|
*/
|
|
480
|
-
beforeCreate
|
|
539
|
+
beforeCreate?: Events['beforeCreate'];
|
|
481
540
|
|
|
482
541
|
/**
|
|
483
542
|
* Runs after the Template's config has been computed, but just before it is compiled.
|
|
484
|
-
*
|
|
485
|
-
* Must return the `html` string.
|
|
543
|
+
*
|
|
544
|
+
* Must return the `html` string, otherwise the original will be used.
|
|
486
545
|
*
|
|
487
546
|
* @default undefined
|
|
488
547
|
*
|
|
489
548
|
* @example
|
|
490
549
|
* ```
|
|
491
550
|
* export default {
|
|
492
|
-
* beforeRender: async ({html, config,
|
|
551
|
+
* beforeRender: async ({html, matter, config, posthtml, transform}) => {
|
|
493
552
|
* // do something...
|
|
494
553
|
* return html;
|
|
495
554
|
* }
|
|
496
555
|
* }
|
|
497
556
|
* ```
|
|
498
557
|
*/
|
|
499
|
-
beforeRender
|
|
558
|
+
beforeRender?: Events['beforeRender'];
|
|
500
559
|
|
|
501
560
|
/**
|
|
502
561
|
* Runs after the Template has been compiled, but before any Transformers have been applied.
|
|
503
|
-
*
|
|
562
|
+
*
|
|
563
|
+
* Must return the `html` string, otherwise the original will be used.
|
|
504
564
|
*
|
|
505
565
|
* @default undefined
|
|
506
566
|
*
|
|
507
567
|
* @example
|
|
508
568
|
* ```
|
|
509
569
|
* export default {
|
|
510
|
-
* afterRender: async ({html, config}) => {
|
|
570
|
+
* afterRender: async ({html, matter, config, posthtml, transform}) => {
|
|
511
571
|
* // do something...
|
|
512
572
|
* return html;
|
|
513
573
|
* }
|
|
514
574
|
* }
|
|
515
575
|
* ```
|
|
516
576
|
*/
|
|
517
|
-
afterRender
|
|
577
|
+
afterRender?: Events['afterRender'];
|
|
518
578
|
|
|
519
579
|
/**
|
|
520
580
|
* Runs after all Transformers have been applied, just before the final HTML is returned.
|
|
521
|
-
*
|
|
581
|
+
*
|
|
582
|
+
* Must return the `html` string, otherwise the original will be used.
|
|
522
583
|
*
|
|
523
584
|
* @default undefined
|
|
524
585
|
*
|
|
525
586
|
* @example
|
|
526
587
|
* ```
|
|
527
588
|
* export default {
|
|
528
|
-
* afterTransformers: async ({html, config,
|
|
589
|
+
* afterTransformers: async ({html, matter, config, posthtml, transform}) => {
|
|
529
590
|
* // do something...
|
|
530
591
|
* return html;
|
|
531
592
|
* }
|
|
532
593
|
* }
|
|
533
594
|
* ```
|
|
534
595
|
*/
|
|
535
|
-
afterTransformers
|
|
596
|
+
afterTransformers?: Events['afterTransformers'];
|
|
536
597
|
|
|
537
598
|
/**
|
|
538
599
|
* Runs after all Templates have been compiled and output to disk.
|
|
539
|
-
*
|
|
600
|
+
* `files` will contain the paths to all the files inside the `build.output.path` directory.
|
|
540
601
|
*
|
|
541
602
|
* @default undefined
|
|
542
603
|
*
|
|
543
604
|
* @example
|
|
544
605
|
* ```
|
|
545
606
|
* export default {
|
|
546
|
-
* afterBuild: async ({files, config,
|
|
607
|
+
* afterBuild: async ({files, config, transform}) => {
|
|
547
608
|
* // do something...
|
|
548
609
|
* }
|
|
549
610
|
* }
|
|
550
611
|
* ```
|
|
551
612
|
*/
|
|
552
|
-
afterBuild
|
|
613
|
+
afterBuild?: Events['afterBuild'];
|
|
614
|
+
|
|
615
|
+
[key: string]: any;
|
|
553
616
|
}
|
package/types/css/inline.d.ts
CHANGED
|
@@ -85,6 +85,8 @@ export default interface InlineCSSConfig {
|
|
|
85
85
|
* Prefer HTML `width` and `height` attributes over inline CSS.
|
|
86
86
|
* The inline CSS `width` and `height` will be removed.
|
|
87
87
|
*
|
|
88
|
+
* Applies to elements set in `widthElements` and `heightElements`.
|
|
89
|
+
*
|
|
88
90
|
* @example
|
|
89
91
|
* ```
|
|
90
92
|
* export default {
|
|
@@ -161,24 +163,6 @@ export default interface InlineCSSConfig {
|
|
|
161
163
|
*/
|
|
162
164
|
customCSS?: string | false;
|
|
163
165
|
|
|
164
|
-
/**
|
|
165
|
-
* Resolve CSS variables and replace them with their values.
|
|
166
|
-
*
|
|
167
|
-
* @default true
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* ```
|
|
171
|
-
* export default {
|
|
172
|
-
* css: {
|
|
173
|
-
* inline: {
|
|
174
|
-
* resolveVariables: true
|
|
175
|
-
* }
|
|
176
|
-
* }
|
|
177
|
-
* }
|
|
178
|
-
* ```
|
|
179
|
-
*/
|
|
180
|
-
resolveVariables?: boolean;
|
|
181
|
-
|
|
182
166
|
/**
|
|
183
167
|
* Remove inlined CSS selectors from the `<style>` tag.
|
|
184
168
|
*
|
|
@@ -197,7 +181,7 @@ export default interface InlineCSSConfig {
|
|
|
197
181
|
removeInlinedSelectors?: boolean;
|
|
198
182
|
|
|
199
183
|
/**
|
|
200
|
-
*
|
|
184
|
+
* Prefer unitless CSS values
|
|
201
185
|
*
|
|
202
186
|
* @default true
|
|
203
187
|
*
|
|
@@ -206,29 +190,29 @@ export default interface InlineCSSConfig {
|
|
|
206
190
|
* export default {
|
|
207
191
|
* css: {
|
|
208
192
|
* inline: {
|
|
209
|
-
*
|
|
193
|
+
* preferUnitless: true
|
|
210
194
|
* }
|
|
211
195
|
* }
|
|
212
196
|
* }
|
|
213
197
|
* ```
|
|
214
198
|
*/
|
|
215
|
-
|
|
199
|
+
preferUnitlessValues?: boolean;
|
|
216
200
|
|
|
217
201
|
/**
|
|
218
|
-
*
|
|
202
|
+
* Array of CSS selectors that should be preserved after inlining.
|
|
219
203
|
*
|
|
220
|
-
* @default
|
|
204
|
+
* @default [] // array of email-client targeting selectors
|
|
221
205
|
*
|
|
222
206
|
* @example
|
|
223
207
|
* ```
|
|
224
208
|
* export default {
|
|
225
209
|
* css: {
|
|
226
210
|
* inline: {
|
|
227
|
-
*
|
|
211
|
+
* safelist: ['.line', '.bg-red-200']
|
|
228
212
|
* }
|
|
229
213
|
* }
|
|
230
214
|
* }
|
|
231
215
|
* ```
|
|
232
|
-
|
|
233
|
-
|
|
216
|
+
*/
|
|
217
|
+
safelist?: string[];
|
|
234
218
|
}
|
package/types/css/purge.d.ts
CHANGED
|
@@ -11,13 +11,13 @@ export default interface PurgeCSSConfig {
|
|
|
11
11
|
* export default {
|
|
12
12
|
* css: {
|
|
13
13
|
* purge: {
|
|
14
|
-
*
|
|
14
|
+
* safelist: ['.some-class', '.Mso*', '#*'],
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* }
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
safelist?: Opts['whitelist'];
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Start and end delimiters for computed classes that you don't want removed.
|
|
@@ -102,7 +102,7 @@ export default interface PurgeCSSConfig {
|
|
|
102
102
|
* }
|
|
103
103
|
* ```
|
|
104
104
|
*/
|
|
105
|
-
doNotRemoveHTMLCommentsWhoseOpeningTagContains
|
|
105
|
+
doNotRemoveHTMLCommentsWhoseOpeningTagContains?: Opts['doNotRemoveHTMLCommentsWhoseOpeningTagContains'];
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Rename all classes and IDs in both your `<style>` tags and your body HTML elements,
|