@maizzle/framework 4.5.0 → 4.6.1

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/src/index.d.ts ADDED
@@ -0,0 +1,2141 @@
1
+ import type {StringifyOptions} from 'query-string';
2
+ import type {CoreBeautifyOptions} from 'js-beautify';
3
+ import type {Options as MarkdownItOptions} from 'markdown-it';
4
+ import type {Opts as PlaintextOptions} from 'string-strip-html';
5
+
6
+ declare namespace MaizzleFramework {
7
+ interface LayoutsConfig {
8
+ /**
9
+ Encoding to be used when reading a layout file from disk.
10
+
11
+ @default 'utf8'
12
+ */
13
+ encoding?: string;
14
+
15
+ /**
16
+ Name of the slot tag, where the content will be injected.
17
+ This is typically used in a Layout file, to define the place where to inject a Template.
18
+
19
+ @default 'block'
20
+ */
21
+ slotTagName?: string;
22
+
23
+ /**
24
+ Name of the fill tag, inside of which content that will be injected is defined.
25
+ This is typically used in a Template file, to extend a Layout.
26
+
27
+ @default 'block'
28
+ */
29
+ fillTagName?: string;
30
+
31
+ /**
32
+ Path to the layouts folder, relative to the project root.
33
+
34
+ @default 'src/layouts'
35
+ */
36
+ root?: string;
37
+
38
+ /**
39
+ Tag name to be used in HTML when extending a layout.
40
+
41
+ @default 'extends'
42
+ */
43
+ tagName?: string;
44
+
45
+ }
46
+
47
+ interface PlaintextConfig extends PlaintextOptions {
48
+ /**
49
+ Configure where plaintext files should be output.
50
+
51
+ @example
52
+ ```
53
+ module.exports = {
54
+ build: {
55
+ plaintext: {
56
+ destination: {
57
+ path: 'dist/brand/plaintext',
58
+ extension: 'rtxt'
59
+ }
60
+ }
61
+ }
62
+ }
63
+ ```
64
+ */
65
+ destination?: {
66
+ /**
67
+ Directory where Maizzle should output compiled Plaintext files.
68
+
69
+ @default 'build_{env}'
70
+
71
+ @example
72
+ ```
73
+ module.exports = {
74
+ build: {
75
+ plaintext: {
76
+ destination: {
77
+ path: 'dist/brand/plaintext'
78
+ }
79
+ }
80
+ }
81
+ }
82
+ ```
83
+ */
84
+ path?: string;
85
+
86
+ /**
87
+ File extension to be used for compiled Plaintext files.
88
+
89
+ @default 'txt'
90
+
91
+ @example
92
+ ```
93
+ module.exports = {
94
+ build: {
95
+ plaintext: {
96
+ destination: {
97
+ extension: 'rtxt'
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+ */
104
+ extension: string;
105
+ };
106
+ }
107
+
108
+ interface TemplatesConfig {
109
+ /**
110
+ Directory where Maizzle should look for Templates to compile.
111
+
112
+ @default 'src/templates'
113
+
114
+ @example
115
+ ```
116
+ module.exports = {
117
+ build: {
118
+ templates: {
119
+ source: 'src/templates'
120
+ }
121
+ }
122
+ }
123
+ ```
124
+ */
125
+ source?:
126
+ | string
127
+ | Array<string | TemplatesConfig>
128
+ | ((config: Config) => string | string[]);
129
+
130
+ /**
131
+ Define what file extensions your Templates use.
132
+ Maizzle will only compile files from your `source` directory that have these extensions.
133
+
134
+ @default 'html'
135
+
136
+ @example
137
+ ```
138
+ module.exports = {
139
+ build: {
140
+ templates: {
141
+ filetypes: ['html', 'blade.php']
142
+ }
143
+ }
144
+ }
145
+ ```
146
+ */
147
+ filetypes?: string | string[];
148
+
149
+ /**
150
+ Define the output path for compiled Templates, and what file extension they should use.
151
+
152
+ @example
153
+ ```
154
+ module.exports = {
155
+ build: {
156
+ templates: {
157
+ destination: {
158
+ path: 'build_production',
159
+ extension: 'html'
160
+ }
161
+ }
162
+ }
163
+ }
164
+ ```
165
+ */
166
+ destination?: {
167
+ /**
168
+ Directory where Maizzle should output compiled Templates.
169
+
170
+ @default 'build_{env}'
171
+ */
172
+ path?: string;
173
+ /**
174
+ File extension to be used for compiled Templates.
175
+
176
+ @default 'html'
177
+ */
178
+ extension: string;
179
+ };
180
+
181
+ /**
182
+ Source and destination directories for your asset files.
183
+
184
+ @example
185
+ ```
186
+ module.exports = {
187
+ build: {
188
+ templates: {
189
+ assets: {
190
+ source: 'src/images',
191
+ destination: 'images'
192
+ }
193
+ }
194
+ }
195
+ }
196
+ ```
197
+ */
198
+ assets?: {
199
+ /**
200
+ Directory where Maizzle should look for asset files.
201
+
202
+ @default ''
203
+ */
204
+ source?: string;
205
+ /**
206
+ Directory where asset files should be copied to.
207
+
208
+ @default 'assets'
209
+ */
210
+ destination?: string;
211
+ };
212
+
213
+ /**
214
+ Configure plaintext generation.
215
+
216
+ @example
217
+ ```
218
+ module.exports = {
219
+ build: {
220
+ plaintext: {
221
+ skipHtmlDecoding: true,
222
+ destination: {
223
+ path: 'dist/brand/plaintext',
224
+ extension: 'rtxt'
225
+ }
226
+ }
227
+ }
228
+ }
229
+ ```
230
+ */
231
+ plaintext?: boolean | PlaintextConfig;
232
+
233
+ /**
234
+ Paths to files or directories from your `source` that should _not_ be copied over to the build destination.
235
+
236
+ @default ['']
237
+
238
+ @example
239
+ ```
240
+ module.exports = {
241
+ build: {
242
+ templates: {
243
+ source: 'src/templates',
244
+ omit: ['1.html', 'archive/4.html'],
245
+ }
246
+ }
247
+ }
248
+ ```
249
+ */
250
+ omit?: string[];
251
+
252
+ /**
253
+ Paths to files relative to your `source` directory that should not be parsed.
254
+ They will be copied over to the build destination as-is.
255
+
256
+ @default ['']
257
+
258
+ @example
259
+ ```
260
+ module.exports = {
261
+ build: {
262
+ templates: {
263
+ source: 'src/templates',
264
+ skip: ['1.html', 'archive/3.html'],
265
+ }
266
+ }
267
+ }
268
+ ```
269
+ */
270
+ skip?: string | string[];
271
+ }
272
+
273
+ interface ComponentsConfig {
274
+ /**
275
+ Root path where to look for folders containing component files.
276
+
277
+ @default './'
278
+ */
279
+ root?: string;
280
+
281
+ /**
282
+ Paths where to look for component files. Must be relative to `root`.
283
+
284
+ @default ['src/components', 'src/layouts', 'src/templates']
285
+ */
286
+ folders?: string[];
287
+
288
+ /**
289
+ Prefix to use for component tags.
290
+
291
+ @default 'x-'
292
+ */
293
+ tagPrefix?: string;
294
+
295
+ /**
296
+ Tag name to be used in HTML when using a component.
297
+
298
+ @default 'component'
299
+ */
300
+ tag?: string;
301
+
302
+ /**
303
+ Attribute name to be used when referencing a component via its path.
304
+
305
+ @default 'src'
306
+ */
307
+ attribute?: string;
308
+
309
+ /**
310
+ File extension that component files must use.
311
+ Any other files will be ignored and not be made available as components.
312
+
313
+ @default 'html'
314
+ */
315
+ fileExtension?: string;
316
+
317
+ /**
318
+ Name of the tag that will be replaced with the content that is passed to the component.
319
+
320
+ @default 'content'
321
+ */
322
+ yield?: string;
323
+
324
+ /**
325
+ Name of the slot tag, where the content will be injected.
326
+
327
+ @default 'slot'
328
+ */
329
+ slot?: string;
330
+
331
+ /**
332
+ Name of the fill tag, where the content to be injected is defined.
333
+
334
+ @default 'fill'
335
+ */
336
+ fill?: string;
337
+
338
+ /**
339
+ String to use as a separator between the slot tag and its name.
340
+
341
+ @default ':'
342
+ */
343
+ slotSeparator?: string;
344
+
345
+ /**
346
+ Tag name for pushing content to a stack.
347
+
348
+ @default 'push'
349
+ */
350
+ push?: string;
351
+
352
+ /**
353
+ Tag name for popping (rendering) content from a stack.
354
+
355
+ @default 'stack'
356
+ */
357
+ stack?: string;
358
+
359
+ /**
360
+ Name of the props attribute to use in the `<script>` tag of a component.
361
+
362
+ @default 'props'
363
+ */
364
+ propsScriptAttribute?: string;
365
+
366
+ /**
367
+ Name of the object that will be used to store the props of a component.
368
+
369
+ @default 'props'
370
+ */
371
+ propsContext?: string;
372
+
373
+ /**
374
+ Name of the attribute that will be used to pass props to a component as JSON.
375
+
376
+ @default 'locals'
377
+ */
378
+ propsAttribute?: string;
379
+
380
+ /**
381
+ Name of the key to use when retrieving props passed to a slot via `$slots.slotName.props`.
382
+
383
+ @default 'props'
384
+ */
385
+ propsSlot?: string;
386
+
387
+ /**
388
+ Configure [`posthtml-parser`](https://github.com/posthtml/posthtml-parser).
389
+
390
+ @default {recognizeSelfClosing:true}
391
+ */
392
+ parserOptions?: Record<string, any>;
393
+
394
+ /**
395
+ Configure [`posthtml-expressions`](https://github.com/posthtml/posthtml-expressions).
396
+
397
+ @default {} // custom object
398
+ */
399
+ expressions?: Record<any, any>;
400
+
401
+ /**
402
+ PostHTML plugins to apply to each parsed component.
403
+
404
+ @default []
405
+ */
406
+ plugins?: any[];
407
+
408
+ /**
409
+ Extra rules for the PostHTML plugin that is used by components to parse attributes.
410
+
411
+ @default {}
412
+ */
413
+ attrsParserRules?: Record<any, any>;
414
+
415
+ /**
416
+ In strict mode, an error will be thrown if a component cannot be rendered.
417
+
418
+ @default true
419
+ */
420
+ strict?: boolean;
421
+
422
+ /**
423
+ Utility methods to be passed to `<script props>` in a component.
424
+
425
+ @default {merge: _.mergeWith, template: _.template}
426
+ */
427
+ utilities?: Record<string, unknown>;
428
+
429
+ /**
430
+ Define additional attributes that should be preserved for specific HTML elements.
431
+
432
+ @default {}
433
+ */
434
+ elementAttributes?: Record<string, void>;
435
+
436
+ /**
437
+ Attributes that should be preserved on all elements in components.
438
+
439
+ @default ['data-*']
440
+ */
441
+ safelistAttributes?: string[];
442
+
443
+ /**
444
+ Attributes that should be removed from all elements in components.
445
+
446
+ @default []
447
+ */
448
+ blacklistAttributes?: string[];
449
+ }
450
+
451
+ interface ExpressionsConfig {
452
+ /**
453
+ Define the starting and ending delimiters used for expressions.
454
+
455
+ @default ['{{', '}}']
456
+ */
457
+ delimiters?: string[];
458
+
459
+ /**
460
+ Define the starting and ending delimiters used for unescaped expressions.
461
+
462
+ @default ['{{{', '}}}']
463
+ */
464
+ unescapeDelimiters?: string[];
465
+
466
+ /**
467
+ Object containing data that will be available under the `page` object.
468
+
469
+ @default {}
470
+ */
471
+ locals?: Record<string, unknown>;
472
+
473
+ /**
474
+ Attribute name for `<script>` tags that contain locals.
475
+
476
+ @default 'locals'
477
+ */
478
+ localsAttr?: string;
479
+
480
+ /**
481
+ Whether to remove `<script>` tags that contain locals.
482
+
483
+ @default false
484
+ */
485
+ removeScriptLocals?: boolean;
486
+
487
+ /**
488
+ Tag names to be used for if/else statements.
489
+
490
+ @default ['if', 'elseif', 'else']
491
+ */
492
+ conditionalTags?: string[];
493
+
494
+ /**
495
+ Tag names to be used for switch statements.
496
+
497
+ @default ['switch', 'case', 'default']
498
+ */
499
+ switchTags?: string[];
500
+
501
+ /**
502
+ Tag names to be used for loops.
503
+
504
+ @default ['each', 'for']
505
+ */
506
+ loopTags?: string[];
507
+
508
+ /**
509
+ Tag names to be used for scopes.
510
+
511
+ @default ['scope']
512
+ */
513
+ scopeTags?: string[];
514
+
515
+ /**
516
+ Name of tag inside of which expression parsing is disabled.
517
+
518
+ @default 'raw'
519
+ */
520
+ ignoredTag?: string;
521
+
522
+ /**
523
+ Enabling strict mode will throw an error if an expression cannot be evaluated.
524
+
525
+ @default false
526
+ */
527
+ strictMode?: boolean;
528
+ }
529
+
530
+ interface TailwindConfig {
531
+ /**
532
+ Path to the Tailwind config file.
533
+
534
+ @default 'tailwind.config.js'
535
+ */
536
+ config?: string;
537
+
538
+ /**
539
+ Path to your main CSS file, that will be compiled with Tailwind CSS.
540
+
541
+ @default 'src/css/tailwind.css'
542
+ */
543
+ css?: string;
544
+
545
+ /**
546
+ Pre-compiled CSS. Skip Tailwind CSS processing by providing your own CSS string.
547
+
548
+ @default ''
549
+ */
550
+ compiled?: string;
551
+ }
552
+
553
+ interface BrowsersyncConfig {
554
+ /**
555
+ Enable the file explorer when the dev server is started.
556
+
557
+ @default true
558
+ */
559
+ directory?: boolean;
560
+
561
+ /**
562
+ Enable Browsersync's pop-over notifications.
563
+
564
+ @default false
565
+ */
566
+ notify?: boolean;
567
+
568
+ /**
569
+ Which URL to open automatically when Browsersync starts.
570
+
571
+ @default false
572
+ */
573
+ open?: boolean | string;
574
+
575
+ /**
576
+ The port to run the dev server on.
577
+
578
+ @default 3000
579
+ */
580
+ port?: number;
581
+
582
+ /**
583
+ Whether to tunnel the dev server through a random public URL.
584
+
585
+ @default false
586
+ */
587
+ tunnel?: boolean | string;
588
+
589
+ /**
590
+ Configure the Browsersync server UI.
591
+
592
+ @default {port: 3001}
593
+ */
594
+ ui?: Record<any, any> | boolean;
595
+
596
+ /**
597
+ Additional paths for Browsersync to watch.
598
+
599
+ @default ['src/**', 'tailwind.config.js', 'config.*.js']
600
+ */
601
+ watch?: string[];
602
+ }
603
+
604
+ interface PostHTMLOptions {
605
+ /**
606
+ Configure the PostHTML parser to process custom directives.
607
+
608
+ @default []
609
+ */
610
+ directives?: any[];
611
+
612
+ /**
613
+ Enable `xmlMode` if you're using Maizzle to output XML content, and not actual HTML.
614
+
615
+ @default false
616
+ */
617
+ xmlMode?: boolean;
618
+
619
+ /**
620
+ Decode entities in the HTML.
621
+
622
+ @default false
623
+ */
624
+ decodeEntities?: boolean;
625
+
626
+ /**
627
+ Output all tags in lowercase. Works only when `xmlMode` is disabled.
628
+
629
+ @default false
630
+ */
631
+ lowerCaseTags?: boolean;
632
+
633
+ /**
634
+ Output all attribute names in lowercase.
635
+
636
+ @default false
637
+ */
638
+ lowerCaseAttributeNames?: boolean;
639
+
640
+ /**
641
+ Recognize CDATA sections as text even if the `xmlMode` option is disabled.
642
+
643
+ @default false
644
+ */
645
+ recognizeCDATA?: boolean;
646
+
647
+ /**
648
+ Recognize self-closing tags.
649
+ Disabling this will cause rendering to stop at the first self-closing custom (non-HTML) tag.
650
+
651
+ @default true
652
+ */
653
+ recognizeSelfClosing?: boolean;
654
+
655
+ /**
656
+ If enabled, AST nodes will have a location property containing the `start` and `end` line and column position of the node.
657
+
658
+ @default false
659
+ */
660
+ sourceLocations?: boolean;
661
+
662
+ /**
663
+ Whether attributes with no values should render exactly as they were written, without `=""` appended.
664
+
665
+ @default true
666
+ */
667
+ recognizeNoValueAttribute?: boolean;
668
+
669
+ /**
670
+ Tell PostHTML to treat custom tags as self-closing.
671
+
672
+ @default []
673
+ */
674
+ singleTags?: string[] | RegExp[];
675
+
676
+ /**
677
+ Define the closing format for single tags.
678
+
679
+ @default 'default'
680
+ */
681
+ closingSingleTag?: 'tag' | 'slash';
682
+
683
+ /**
684
+ Whether to quote all attribute values.
685
+
686
+ @default true
687
+ */
688
+ quoteAllAttributes?: boolean;
689
+
690
+ /**
691
+ Replaces quotes in attribute values with `&quote;`.
692
+
693
+ @default true
694
+ */
695
+ replaceQuote?: boolean;
696
+
697
+ /**
698
+ Specify the style of quote around the attribute values.
699
+
700
+ @default 2
701
+
702
+ @example
703
+
704
+ `0` - Quote style is based on attribute values (an alternative for `replaceQuote` option)
705
+
706
+ ```
707
+ <img src="example.jpg" onload='testFunc("test")'>
708
+ ```
709
+
710
+ @example
711
+
712
+ `1` - Attribute values are wrapped in single quotes
713
+
714
+ ```
715
+ <img src='example.jpg' onload='testFunc("test")'>
716
+ ```
717
+
718
+ @example
719
+
720
+ `2` - Attribute values are wrapped in double quotes
721
+
722
+ ```
723
+ <img src="example.jpg" onload="testFunc("test")">
724
+ ```
725
+ */
726
+ quoteStyle?: 0 | 1 | 2;
727
+ }
728
+
729
+ interface PostHTMLConfig {
730
+ /**
731
+ Configure expressions.
732
+ */
733
+ expressions?: ExpressionsConfig;
734
+
735
+ /**
736
+ Configure PostHTML options.
737
+ */
738
+ options?: PostHTMLOptions;
739
+
740
+ /**
741
+ Additional PostHTML plugins that you would like to use.
742
+
743
+ These will run last, after components.
744
+
745
+ @default []
746
+
747
+ @example
748
+ ```
749
+ const spaceless = require('posthtml-spaceless')
750
+ module.exports = {
751
+ build: {
752
+ posthtml: {
753
+ plugins: [
754
+ spaceless()
755
+ ]
756
+ }
757
+ }
758
+ }
759
+ ```
760
+ */
761
+ plugins?: any[];
762
+
763
+ /**
764
+ Configure the `posthtml-mso` plugin.
765
+ */
766
+ outlook?: {
767
+ /**
768
+ The tag name to use for Outlook conditional comments.
769
+
770
+ @default 'outlook'
771
+
772
+ @example
773
+ ```
774
+ module.exports = {
775
+ build: {
776
+ posthtml: {
777
+ outlook: {
778
+ tag: 'mso'
779
+ }
780
+ }
781
+ }
782
+ }
783
+ // You now write <mso>...</mso> instead of <outlook>...</outlook>
784
+ ```
785
+ */
786
+ tag?: string;
787
+ };
788
+ }
789
+
790
+ interface BuildConfig {
791
+ /**
792
+ Templates configuration.
793
+ */
794
+ templates: TemplatesConfig;
795
+ /**
796
+ Tailwind CSS configuration.
797
+ */
798
+ tailwind?: TailwindConfig;
799
+ /**
800
+ [DEPRECATED] Layouts configuration.
801
+ */
802
+ layouts?: LayoutsConfig;
803
+ /**
804
+ Components configuration.
805
+ */
806
+ components?: ComponentsConfig;
807
+ /**
808
+ PostHTML configuration.
809
+ */
810
+ posthtml?: PostHTMLConfig;
811
+ /**
812
+ Configure PostCSS
813
+ */
814
+ postcss?: {
815
+ /**
816
+ Additional PostCSS plugins that you would like to use.
817
+
818
+ @default []
819
+
820
+ @example
821
+ ```
822
+ const examplePlugin = require('postcss-example-plugin')
823
+ module.exports = {
824
+ build: {
825
+ postcss: {
826
+ plugins: [
827
+ examplePlugin()
828
+ ]
829
+ }
830
+ }
831
+ }
832
+ ```
833
+ */
834
+ plugins?: any[];
835
+ };
836
+ /**
837
+ Browsersync configuration.
838
+
839
+ When you run the `maizzle serve` command, Maizzle uses [Browsersync](https://browsersync.io/)
840
+ to start a local development server and open a directory listing of your emails in your default browser.
841
+ */
842
+ browsersync?: BrowsersyncConfig;
843
+ /**
844
+ Configure how build errors are handled when developing with the Maizzle CLI.
845
+
846
+ @default undefined
847
+ */
848
+ fail?: 'silent' | 'verbose';
849
+ }
850
+
851
+ type AttributeToStyleSupportedAttributes =
852
+ | 'width'
853
+ | 'height'
854
+ | 'bgcolor'
855
+ | 'background'
856
+ | 'align'
857
+ | 'valign';
858
+
859
+ interface InlineCSSConfig {
860
+ /**
861
+ Which CSS properties should be duplicated as what HTML attributes.
862
+
863
+ @default {}
864
+
865
+ @example
866
+ ```
867
+ module.exports = {
868
+ build: {
869
+ inlineCSS: {
870
+ styleToAttribute: {
871
+ 'background-color': 'bgcolor',
872
+ }
873
+ }
874
+ }
875
+ }
876
+ ```
877
+ */
878
+ styleToAttribute?: Record<string, string>;
879
+
880
+ /**
881
+ Duplicate HTML attributes to inline CSS.
882
+
883
+ @default false
884
+
885
+ @example
886
+ ```
887
+ module.exports = {
888
+ build: {
889
+ inlineCSS: {
890
+ attributeToStyle: ['width', 'bgcolor', 'background']
891
+ }
892
+ }
893
+ }
894
+ ```
895
+ */
896
+ attributeToStyle?: boolean | AttributeToStyleSupportedAttributes[];
897
+
898
+ /**
899
+ HTML elements that will receive `width` attributes based on inline CSS width.
900
+
901
+ @default []
902
+
903
+ @example
904
+ ```
905
+ module.exports = {
906
+ build: {
907
+ inlineCSS: {
908
+ applyWidthAttributes: ['td', 'th']
909
+ }
910
+ }
911
+ }
912
+ ```
913
+ */
914
+ applyWidthAttributes?: string[];
915
+
916
+ /**
917
+ HTML elements that will receive `height` attributes based on inline CSS height.
918
+
919
+ @default []
920
+
921
+ @example
922
+ ```
923
+ module.exports = {
924
+ build: {
925
+ inlineCSS: {
926
+ applyHeightAttributes: ['td', 'th']
927
+ }
928
+ }
929
+ }
930
+ ```
931
+ */
932
+ applyHeightAttributes?: string[];
933
+
934
+ /**
935
+ List of elements that should only use `width` and `height`. Their inline CSS `width` and `height` will be removed.
936
+
937
+ @example
938
+ ```
939
+ module.exports = {
940
+ inlineCSS: {
941
+ keepOnlyAttributeSizes: {
942
+ width: ['img', 'video'],
943
+ height: ['img', 'video']
944
+ }
945
+ }
946
+ }
947
+ ```
948
+ */
949
+ keepOnlyAttributeSizes?: {
950
+ /**
951
+ List of elements that should only use the `width` HTML attribute (inline CSS width will be removed).
952
+
953
+ @default []
954
+
955
+ @example
956
+ ```
957
+ module.exports = {
958
+ inlineCSS: {
959
+ keepOnlyAttributeSizes: {
960
+ width: ['img', 'video'],
961
+ }
962
+ }
963
+ }
964
+ ```
965
+ */
966
+ width?: string[];
967
+ /**
968
+ List of elements that should only use the `height` HTML attribute (inline CSS height will be removed).
969
+
970
+ @default []
971
+
972
+ @example
973
+ ```
974
+ module.exports = {
975
+ inlineCSS: {
976
+ keepOnlyAttributeSizes: {
977
+ height: ['img', 'video']
978
+ }
979
+ }
980
+ }
981
+ ```
982
+ */
983
+ height?: string[];
984
+ };
985
+
986
+ /**
987
+ Remove inlined `background-color` CSS on elements containing a `bgcolor` HTML attribute.
988
+
989
+ @default false
990
+
991
+ @example
992
+ ```
993
+ module.exports = {
994
+ inlineCSS: {
995
+ preferBgColorAttribute: ['td'] // default: ['body', 'marquee', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr']
996
+ }
997
+ }
998
+ ```
999
+ */
1000
+ preferBgColorAttribute?: boolean | string[];
1001
+
1002
+ /**
1003
+ Array of CSS property names that should be excluded from the CSS inlining process. `--tw-shadow` is excluded by default.
1004
+
1005
+ @default []
1006
+
1007
+ @example
1008
+ ```
1009
+ module.exports = {
1010
+ inlineCSS: {
1011
+ excludedProperties: ['padding', 'padding-left']
1012
+ }
1013
+ }
1014
+ ```
1015
+ */
1016
+ excludedProperties?: string[];
1017
+
1018
+ /**
1019
+ An object where each value has a `start` and `end` to specify fenced code blocks that should be ignored during CSS inlining.
1020
+
1021
+ @default {EJS: {}, HBS: {}}
1022
+
1023
+ @example
1024
+ ```
1025
+ module.exports = {
1026
+ EJS: { start: '<%', end: '%>' },
1027
+ HBS: { start: '{{', end: '}}' },
1028
+ }
1029
+ ```
1030
+ */
1031
+ codeBlocks?: {
1032
+ EJS?: Record<string, string>;
1033
+ HBS?: Record<string, string>;
1034
+ };
1035
+
1036
+ /**
1037
+ Provide your own CSS to be inlined. Must be vanilla or pre-compiled CSS.
1038
+
1039
+ Existing `<style>` in your HTML tags will be ignored and their contents won't be inlined.
1040
+
1041
+ @default undefined
1042
+
1043
+ @example
1044
+ ```
1045
+ module.exports = {
1046
+ inlineCSS: {
1047
+ customCSS: `
1048
+ .custom-class {
1049
+ color: red;
1050
+ }
1051
+ `
1052
+ }
1053
+ }
1054
+ ```
1055
+ */
1056
+ customCSS?: string;
1057
+ }
1058
+
1059
+ interface RemoveUnusedCSSConfig {
1060
+ /**
1061
+ Classes or IDs that you don't want removed.
1062
+
1063
+ @default []
1064
+
1065
+ @example
1066
+ ```
1067
+ module.exports = {
1068
+ removeUnusedCSS: {
1069
+ whitelist: ['.some-class', '.Mso*', '#*'],
1070
+ }
1071
+ }
1072
+ ```
1073
+ */
1074
+ whitelist?: string[];
1075
+
1076
+ /**
1077
+ Start and end delimiters for computed classes that you don't want removed.
1078
+
1079
+ @default [{heads: '{{', tails: '}}'}, {heads: '{%', tails: '%}'}]
1080
+
1081
+ @example
1082
+ ```
1083
+ module.exports = {
1084
+ removeUnusedCSS: {
1085
+ backend: [
1086
+ { heads: '[[', tails: ']]' },
1087
+ ]
1088
+ }
1089
+ }
1090
+ ```
1091
+ */
1092
+ backend?: Array<Record<string, string>>;
1093
+
1094
+ /**
1095
+ Whether to remove `<!-- HTML comments -->`.
1096
+
1097
+ @default true
1098
+
1099
+ @example
1100
+ ```
1101
+ module.exports = {
1102
+ removeUnusedCSS: {
1103
+ removeHTMLComments: false
1104
+ }
1105
+ }
1106
+ ```
1107
+ */
1108
+ removeHTMLComments?: boolean;
1109
+
1110
+ /**
1111
+ Whether to remove `/* CSS comments *\/`.
1112
+
1113
+ @default true
1114
+
1115
+ @example
1116
+ ```
1117
+ module.exports = {
1118
+ removeUnusedCSS: {
1119
+ removeCSSComments: false
1120
+ }
1121
+ }
1122
+ ```
1123
+ */
1124
+ removeCSSComments?: boolean;
1125
+
1126
+ /**
1127
+ Whether to remove classes that have been inlined.
1128
+
1129
+ @default undefined
1130
+
1131
+ @example
1132
+ ```
1133
+ module.exports = {
1134
+ removeUnusedCSS: {
1135
+ removeInlinedSelectors: false,
1136
+ }
1137
+ }
1138
+ ```
1139
+ */
1140
+ removeInlinedSelectors?: boolean;
1141
+
1142
+ /**
1143
+ List of strings representing start of a conditional comment that should not be removed.
1144
+
1145
+ @default ['[if', '[endif']
1146
+
1147
+ @example
1148
+ ```
1149
+ module.exports = {
1150
+ removeUnusedCSS: {
1151
+ doNotRemoveHTMLCommentsWhoseOpeningTagContains: ['[if', '[endif']
1152
+ }
1153
+ }
1154
+ ```
1155
+ */
1156
+ doNotRemoveHTMLCommentsWhoseOpeningTagContains: string[];
1157
+
1158
+ /**
1159
+ Rename all classes and IDs in both your `<style>` tags and your body HTML elements, to be as few characters as possible.
1160
+
1161
+ @default false
1162
+
1163
+ @example
1164
+ ```
1165
+ module.exports = {
1166
+ removeUnusedCSS: {
1167
+ uglify: true
1168
+ }
1169
+ }
1170
+ ```
1171
+ */
1172
+ uglify?: boolean;
1173
+ }
1174
+
1175
+ interface URLParametersConfig {
1176
+ [key: string]: any;
1177
+
1178
+ _options?: {
1179
+ /**
1180
+ Array of tag names to process. Only URLs inside `href` attributes of tags in this array will be processed.
1181
+
1182
+ @default ['a']
1183
+
1184
+ @example
1185
+ ```
1186
+ module.exports = {
1187
+ urlParameters: {
1188
+ _options: {
1189
+ tags: ['a[href*="example.com"]'],
1190
+ },
1191
+ utm_source: 'maizzle',
1192
+ }
1193
+ }
1194
+ ```
1195
+ */
1196
+ tags?: string[];
1197
+
1198
+ /**
1199
+ By default, query parameters are appended only to valid URLs.
1200
+ Disable strict mode to append parameters to any string.
1201
+
1202
+ @default true
1203
+ */
1204
+ strict?: boolean;
1205
+
1206
+ /**
1207
+ Options to pass to the `query-string` library.
1208
+ */
1209
+ qs?: StringifyOptions;
1210
+ };
1211
+ }
1212
+
1213
+ interface WidowWordsConfig {
1214
+ /**
1215
+ The attribute name to use.
1216
+
1217
+ @default 'prevent-widows'
1218
+ */
1219
+ attrName?: string;
1220
+
1221
+ /**
1222
+ Replace all widow word `nbsp;` instances with a single space.
1223
+ This is basically the opposite of preventing widow words.
1224
+
1225
+ @default false
1226
+ */
1227
+ removeWindowPreventionMeasures?: boolean;
1228
+
1229
+ /**
1230
+ Convert the space entity to the `targetLanguage`.
1231
+
1232
+ @default true
1233
+ */
1234
+ convertEntities?: boolean;
1235
+
1236
+ /**
1237
+ Language to encode non-breaking spaces in.
1238
+
1239
+ @default 'html'
1240
+ */
1241
+ targetLanguage?: 'html' | 'css' | 'js';
1242
+
1243
+ /**
1244
+ Should whitespace in front of dashes (-), n-dashes (–) or m-dashes (—) be replaced with a `&nbsp;`.
1245
+
1246
+ @default true
1247
+ */
1248
+ hyphens?: boolean;
1249
+
1250
+ /**
1251
+ The minimum amount of words in a target string, in order to trigger the transformer.
1252
+
1253
+ @default 3
1254
+ */
1255
+ minWordCount?: number;
1256
+
1257
+ /**
1258
+ The minimum amount non-whitespace characters in a target string, in order to trigger the transformer.
1259
+
1260
+ @default 20
1261
+ */
1262
+ minCharCount?: number;
1263
+
1264
+ /**
1265
+ Start/end pairs of strings that will prevent the transformer from removing widow words inside them.
1266
+ */
1267
+ ignore?: string | string[];
1268
+ }
1269
+
1270
+ interface MarkdownConfig {
1271
+ /**
1272
+ Path relative to which markdown files are imported.
1273
+
1274
+ @default './'
1275
+ */
1276
+ root?: string;
1277
+
1278
+ /**
1279
+ Encoding for imported Markdown files.
1280
+
1281
+ @default 'utf8'
1282
+ */
1283
+ encoding?: string;
1284
+
1285
+ /**
1286
+ Options to pass to the `markdown-it` library.
1287
+
1288
+ @default {}
1289
+ */
1290
+ markdownit?: MarkdownItOptions;
1291
+
1292
+ /**
1293
+ Plugins for the `markdown-it` library.
1294
+
1295
+ @default []
1296
+ */
1297
+ plugins?: any[];
1298
+ }
1299
+
1300
+ interface MinifyConfig {
1301
+ /**
1302
+ Maximum line length. Works only when `removeLineBreaks` is `true`.
1303
+
1304
+ @default 500
1305
+ */
1306
+ lineLengthLimit?: number;
1307
+
1308
+ /**
1309
+ Remove all line breaks from HTML when minifying.
1310
+
1311
+ @default true
1312
+ */
1313
+ removeLineBreaks?: boolean;
1314
+
1315
+ /**
1316
+ Remove code indentation when minifying HTML.
1317
+
1318
+ @default true
1319
+ */
1320
+ removeIndentations?: boolean;
1321
+
1322
+ /**
1323
+ Remove `<!-- HTML comments -->` when minifying HTML.
1324
+
1325
+ `0` - don't remove any HTML comments
1326
+
1327
+ `1` - remove all comments except Outlook conditional comments
1328
+
1329
+ `2` - remove all comments, including Outlook conditional comments
1330
+
1331
+ @default false
1332
+ */
1333
+ removeHTMLComments?: boolean | number;
1334
+
1335
+ /**
1336
+ Remove CSS comments when minifying HTML.
1337
+
1338
+ @default true
1339
+ */
1340
+ removeCSSComments?: boolean;
1341
+
1342
+ /**
1343
+ When any of given strings are encountered and `removeLineBreaks` is true, current line will be terminated.
1344
+
1345
+ @default
1346
+ [
1347
+ '</td',
1348
+ '<html',
1349
+ '</html',
1350
+ '<head',
1351
+ '</head',
1352
+ '<meta',
1353
+ '<link',
1354
+ '<table',
1355
+ '<script',
1356
+ '</script',
1357
+ '<!DOCTYPE',
1358
+ '<style',
1359
+ '</style',
1360
+ '<title',
1361
+ '<body',
1362
+ '@media',
1363
+ '</body',
1364
+ '<!--[if',
1365
+ '<!--<![endif',
1366
+ '<![endif]'
1367
+ ]
1368
+ */
1369
+ breakToTheLeftOf?: string[] | boolean | null;
1370
+
1371
+ /**
1372
+ Some inline tags can accidentally introduce extra text.
1373
+ The minifier will take extra precaution when minifying around these tags.
1374
+
1375
+ @default
1376
+ [
1377
+ 'a',
1378
+ 'abbr',
1379
+ 'acronym',
1380
+ 'audio',
1381
+ 'b',
1382
+ 'bdi',
1383
+ 'bdo',
1384
+ 'big',
1385
+ 'br',
1386
+ 'button',
1387
+ 'canvas',
1388
+ 'cite',
1389
+ 'code',
1390
+ 'data',
1391
+ 'datalist',
1392
+ 'del',
1393
+ 'dfn',
1394
+ 'em',
1395
+ 'embed',
1396
+ 'i',
1397
+ 'iframe',
1398
+ 'img',
1399
+ 'input',
1400
+ 'ins',
1401
+ 'kbd',
1402
+ 'label',
1403
+ 'map',
1404
+ 'mark',
1405
+ 'meter',
1406
+ 'noscript',
1407
+ 'object',
1408
+ 'output',
1409
+ 'picture',
1410
+ 'progress',
1411
+ 'q',
1412
+ 'ruby',
1413
+ 's',
1414
+ 'samp',
1415
+ 'script',
1416
+ 'select',
1417
+ 'slot',
1418
+ 'small',
1419
+ 'span',
1420
+ 'strong',
1421
+ 'sub',
1422
+ 'sup',
1423
+ 'svg',
1424
+ 'template',
1425
+ 'textarea',
1426
+ 'time',
1427
+ 'u',
1428
+ 'tt',
1429
+ 'var',
1430
+ 'video',
1431
+ 'wbr'
1432
+ ]
1433
+ */
1434
+ mindTheInlineTags?: string[] | boolean | null;
1435
+ }
1436
+
1437
+ interface BaseURLConfig {
1438
+ /**
1439
+ The URL to prepend.
1440
+
1441
+ @default undefined
1442
+ */
1443
+ url: string;
1444
+
1445
+ /**
1446
+ Tags to apply the `url` to. When using this option, the `url` will only be prepended to the specified tags.
1447
+
1448
+ Maizzle uses a [custom set of tags](https://github.com/posthtml/posthtml-base-url/blob/main/lib/index.js#L6-L60) by default.
1449
+
1450
+ @example
1451
+
1452
+ Prepend `url` to all 'source'-like attribute values on image tags, like `src` and `srcset`:
1453
+
1454
+ ```
1455
+ module.exports = {
1456
+ baseURL: {
1457
+ url: 'https://cdn.example.com/',
1458
+ tags: ['img'],
1459
+ },
1460
+ }
1461
+ ```
1462
+
1463
+ With more granular control:
1464
+
1465
+ ```
1466
+ module.exports = {
1467
+ baseURL: {
1468
+ url: 'https://cdn.example.com/',
1469
+ tags: {
1470
+ img: {
1471
+ src: true, // use the value of `url` above
1472
+ srcset: 'https://bar.com/',
1473
+ },
1474
+ },
1475
+ },
1476
+ }
1477
+ ```
1478
+ */
1479
+ tags?: string[] | Record<string, unknown>;
1480
+
1481
+ /**
1482
+ Key-value pairs of attributes and the string to prepend to their existing value.
1483
+
1484
+ @default {}
1485
+
1486
+ @example
1487
+
1488
+ Prepend `https://example.com/` to all `data-url` attribute values:
1489
+
1490
+ ```
1491
+ module.exports = {
1492
+ baseURL: {
1493
+ attributes: {
1494
+ 'data-url': 'https://example.com/',
1495
+ },
1496
+ },
1497
+ }
1498
+ ```
1499
+ */
1500
+ attributes?: Record<string, unknown>;
1501
+
1502
+ /**
1503
+ Whether the string defined in `url` should be prepended to `url()` values in CSS `<style>` tags.
1504
+
1505
+ @default true
1506
+ */
1507
+ styleTag?: boolean;
1508
+
1509
+ /**
1510
+ Whether the string defined in `url` should be prepended to `url()` values in inline CSS.
1511
+
1512
+ @default true
1513
+ */
1514
+ inlineCss?: boolean;
1515
+ }
1516
+
1517
+ interface Config {
1518
+ [key: string]: any;
1519
+
1520
+ /**
1521
+ Configure build settings.
1522
+
1523
+ @example
1524
+ ```
1525
+ module.exports = {
1526
+ build: {
1527
+ templates: TemplatesConfig,
1528
+ tailwind: TailwindConfig,
1529
+ layouts: LayoutsConfig,
1530
+ components: ComponentsConfig,
1531
+ posthtml: PostHTMLConfig,
1532
+ browserSync: BrowserSyncConfig,
1533
+ fail: 'silent' // or 'verbose'
1534
+ }
1535
+ }
1536
+ ```
1537
+ */
1538
+ build: BuildConfig;
1539
+
1540
+ /**
1541
+ Toggle the use of Transformers.
1542
+
1543
+ @default true
1544
+
1545
+ @example
1546
+ ```
1547
+ module.exports = {
1548
+ applyTransformers: false,
1549
+ }
1550
+ ```
1551
+ */
1552
+ applyTransformers?: boolean;
1553
+
1554
+ /**
1555
+ Configure CSS inlining.
1556
+
1557
+ To enable it with defaults, simply set it to `true`.
1558
+ @example
1559
+ ```js
1560
+ module.exports = {
1561
+ inlineCSS: true,
1562
+ }
1563
+ ```
1564
+ */
1565
+ inlineCSS?: boolean | InlineCSSConfig;
1566
+
1567
+ /**
1568
+ Configure unused CSS purging.
1569
+
1570
+ To enable it with defaults, simply set it to `true`.
1571
+ @example
1572
+ ```
1573
+ module.exports = {
1574
+ removeUnusedCSS: true,
1575
+ }
1576
+ ```
1577
+ */
1578
+ removeUnusedCSS?: boolean | RemoveUnusedCSSConfig;
1579
+
1580
+ /**
1581
+ Automatically remove HTML attributes.
1582
+
1583
+ By default, empty `style` and `class` attributes are removed.
1584
+
1585
+ @default ['style', 'class']
1586
+
1587
+ @example
1588
+ ```
1589
+ module.exports = {
1590
+ removeAttributes: ['data-src']
1591
+ }
1592
+ ```
1593
+ */
1594
+ removeAttributes?:
1595
+ | string[]
1596
+ | Array<{
1597
+ name: string;
1598
+ value: string | RegExp;
1599
+ }>;
1600
+
1601
+ /**
1602
+ Prevent widow words inside a tag by adding a `&nbsp;` between its last two words.
1603
+
1604
+ @example
1605
+ ```
1606
+ module.exports = {
1607
+ widowWords: true,
1608
+ }
1609
+ ```
1610
+ */
1611
+ widowWords?: WidowWordsConfig;
1612
+
1613
+ /**
1614
+ [Add attributes](https://maizzle.com/docs/transformers/add-attributes) to elements in your HTML.
1615
+
1616
+ @default
1617
+ {
1618
+ table: {
1619
+ cellpadding: 0,
1620
+ cellspacing: 0,
1621
+ role: 'none'
1622
+ },
1623
+ img: {
1624
+ alt: ''
1625
+ },
1626
+ }
1627
+ */
1628
+ extraAttributes?: boolean | Record<string, unknown>;
1629
+
1630
+ /**
1631
+ Normalize escaped character class names like `\:` or `\/` by replacing them with email-safe alternatives.
1632
+
1633
+ @example
1634
+ ```
1635
+ module.exports = {
1636
+ safeClassNames: {
1637
+ ':': '__',
1638
+ '!': 'i-',
1639
+ }
1640
+ }
1641
+ ```
1642
+ */
1643
+ safeClassNames?: boolean | Record<string, string>;
1644
+
1645
+ /**
1646
+ Rewrite longhand CSS inside style attributes with shorthand syntax.
1647
+ Only works with margin, padding and border, and only when all sides are specified.
1648
+
1649
+ @default []
1650
+
1651
+ @example
1652
+ ```
1653
+ module.exports = {
1654
+ shorthandCSS: true, // or ['td', 'div'] to only apply to those tags
1655
+ }
1656
+ ```
1657
+ */
1658
+ shorthandCSS?: boolean | string[];
1659
+
1660
+ /**
1661
+ Define a string that will be prepended to sources and hrefs in your HTML and CSS.
1662
+
1663
+ @example
1664
+
1665
+ Prepend to all sources and hrefs:
1666
+
1667
+ ```
1668
+ module.exports = {
1669
+ baseURL: 'https://cdn.example.com/'
1670
+ }
1671
+ ```
1672
+
1673
+ Prepend only to `src` attributes on image tags:
1674
+
1675
+ ```
1676
+ module.exports = {
1677
+ baseURL: {
1678
+ url: 'https://cdn.example.com/',
1679
+ tags: ['img'],
1680
+ },
1681
+ }
1682
+ ```
1683
+ */
1684
+ baseURL?: string | BaseURLConfig;
1685
+
1686
+ /**
1687
+ Transform text inside elements marked with custom attributes.
1688
+
1689
+ Filters work only on elements that contain only text.
1690
+
1691
+ @default {}
1692
+
1693
+ @example
1694
+ ```
1695
+ module.exports = {
1696
+ filters: {
1697
+ uppercase: str => str.toUpperCase()
1698
+ }
1699
+ }
1700
+ ```
1701
+ */
1702
+ filters: Record<string, unknown>;
1703
+
1704
+ /**
1705
+ Define variables outside of the `page` object.
1706
+
1707
+ @default {}
1708
+
1709
+ @example
1710
+ ```
1711
+ module.exports = {
1712
+ locals: {
1713
+ company: {
1714
+ name: 'Spacely Space Sprockets, Inc.'
1715
+ }
1716
+ }
1717
+ }
1718
+ ```
1719
+
1720
+ `company` can be then used like this:
1721
+
1722
+ ```
1723
+ <p>{{ company.name }}</p>
1724
+ ```
1725
+ */
1726
+ locals?: Record<string, unknown>;
1727
+
1728
+ /**
1729
+ Configure custom parameters to append to URLs.
1730
+
1731
+ @example
1732
+ ```
1733
+ module.exports = {
1734
+ urlParameters: {
1735
+ _options: {
1736
+ tags: ['a'],
1737
+ qs: {}, // options for the `query-string` library
1738
+ },
1739
+ utm_source: 'maizzle',
1740
+ utm_campaign: 'Campaign Name',
1741
+ utm_medium: 'email',
1742
+ custom_parameter: 'foo',
1743
+ '1stOfApril': 'bar',
1744
+ }
1745
+ }
1746
+ ```
1747
+ */
1748
+ urlParameters?: URLParametersConfig;
1749
+
1750
+ /**
1751
+ Ensure that all your HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
1752
+
1753
+ @default true
1754
+
1755
+ @example
1756
+ ```
1757
+ module.exports = {
1758
+ sixHex: false,
1759
+ }
1760
+ ```
1761
+ */
1762
+ sixHex?: boolean;
1763
+
1764
+ /**
1765
+ [Pretty print](https://maizzle.com/docs/transformers/prettify) your HTML email code so that it's nicely indented and more human-readable.
1766
+
1767
+ @default undefined
1768
+
1769
+ @example
1770
+ ```
1771
+ module.exports = {
1772
+ prettify: true,
1773
+ }
1774
+ ```
1775
+ */
1776
+ prettify?: boolean | CoreBeautifyOptions;
1777
+
1778
+ /**
1779
+ Minify the compiled HTML email code.
1780
+
1781
+ @default false
1782
+
1783
+ @example
1784
+ ```
1785
+ module.exports = {
1786
+ minify: true,
1787
+ }
1788
+ ```
1789
+ */
1790
+ minify?: boolean | MinifyConfig;
1791
+
1792
+ /**
1793
+ Configure the Markdown parser.
1794
+
1795
+ @example
1796
+
1797
+ ```
1798
+ module.exports = {
1799
+ markdown: {
1800
+ root: './', // A path relative to which markdown files are imported
1801
+ encoding: 'utf8', // Encoding for imported Markdown files
1802
+ markdownit: {}, // Options passed to markdown-it
1803
+ plugins: [], // Plugins for markdown-it
1804
+ }
1805
+ }
1806
+ ```
1807
+ */
1808
+ markdown?: MarkdownConfig;
1809
+
1810
+ /**
1811
+ Batch-replace strings in your HTML.
1812
+
1813
+ @default {}
1814
+
1815
+ @example
1816
+ ```
1817
+ module.exports = {
1818
+ replaceStrings: {
1819
+ 'replace this exact string': 'with this one',
1820
+ '\\s?data-src=""': '', // remove empty data-src="" attributes
1821
+ }
1822
+ }
1823
+ ```
1824
+ */
1825
+ replaceStrings?: Record<string, string>;
1826
+ }
1827
+
1828
+ interface RenderOptions {
1829
+ /**
1830
+ A Maizzle configuration object.
1831
+
1832
+ @default {}
1833
+
1834
+ @example
1835
+ ```
1836
+ const Maizzle = require('@maizzle/framework');
1837
+
1838
+ Maizzle
1839
+ .render(`html string`, {
1840
+ maizzle: {
1841
+ inlineCSS: true,
1842
+ }
1843
+ })
1844
+ .then(({html, config}) => console.log(html, config))
1845
+ ```
1846
+ */
1847
+ maizzle: Config;
1848
+
1849
+ /**
1850
+ Tailwind CSS configuration object.
1851
+
1852
+ @default {}
1853
+
1854
+ @example
1855
+ ```
1856
+ const Maizzle = require('@maizzle/framework');
1857
+
1858
+ Maizzle
1859
+ .render(`html string`, {
1860
+ tailwind: {
1861
+ config: './tailwind-custom.config.js',
1862
+ },
1863
+ })
1864
+ .then(({html, config}) => console.log(html, config))
1865
+ ```
1866
+ */
1867
+ tailwind?: TailwindConfig;
1868
+
1869
+ /**
1870
+ A function that runs after the Template's config has been computed, but just before it is compiled.
1871
+
1872
+ It exposes the Template's config, as well as the HTML.
1873
+
1874
+ @default undefined
1875
+
1876
+ @example
1877
+ ```
1878
+ const Maizzle = require('@maizzle/framework');
1879
+
1880
+ Maizzle
1881
+ .render(`html string`, {
1882
+ beforeRender: (html, config) => {
1883
+ // do something with html and config
1884
+ return html;
1885
+ },
1886
+ })
1887
+ .then(({html, config}) => console.log(html, config))
1888
+ ```
1889
+ */
1890
+ beforeRender?: (html: string, config: Config) => string;
1891
+
1892
+ /**
1893
+ A function that runs after the Template has been compiled, but before any Transformers have been applied.
1894
+
1895
+ Exposes the rendered html string and the Templates' config.
1896
+
1897
+ @default undefined
1898
+
1899
+ @example
1900
+ ```
1901
+ const Maizzle = require('@maizzle/framework');
1902
+
1903
+ Maizzle
1904
+ .render(`html string`, {
1905
+ afterRender: (html, config) => {
1906
+ // do something with html and config
1907
+ return html;
1908
+ },
1909
+ })
1910
+ .then(({html, config}) => console.log(html, config))
1911
+ ```
1912
+ */
1913
+ afterRender?: (html: string, config: Config) => string;
1914
+
1915
+ /**
1916
+ A function that runs after all Transformers have been applied, just before the final HTML is returned.
1917
+
1918
+ It exposes the Template's config, as well as the HTML.
1919
+
1920
+ @default undefined
1921
+
1922
+ @example
1923
+ ```
1924
+ const Maizzle = require('@maizzle/framework');
1925
+
1926
+ Maizzle
1927
+ .render(`html string`, {
1928
+ afterTransformers: (html, config) => {
1929
+ // do something with html and config
1930
+ return html;
1931
+ },
1932
+ })
1933
+ .then(({html, config}) => console.log(html, config))
1934
+ ```
1935
+ */
1936
+ afterTransformers?: (html: string, config: Config) => string;
1937
+ }
1938
+
1939
+ type RenderOutput = {
1940
+ /**
1941
+ The rendered HTML.
1942
+ */
1943
+ html: string;
1944
+
1945
+ /**
1946
+ The Maizzle configuration object.
1947
+ */
1948
+ config: Config;
1949
+ };
1950
+
1951
+ /**
1952
+ Compile an HTML string with Maizzle.
1953
+
1954
+ @param {string} html The HTML string to render.
1955
+ @param {RenderOptions} [options] Options to pass to the renderer.
1956
+ */
1957
+ function render(html: string, options?: RenderOptions): Promise<RenderOutput>;
1958
+
1959
+ /**
1960
+ Normalize escaped character class names like `\:` or `\/` by replacing them with email-safe alternatives.
1961
+
1962
+ @param {string} html The HTML string to render.
1963
+ @param {object} replacements Customize replacements strategy.
1964
+ */
1965
+ function safeClassNames(html: string, replacements: Record<string, string>): string;
1966
+
1967
+ /**
1968
+ Compile Markdown to HTML.
1969
+
1970
+ @param {string} input String to compile with Markdown.
1971
+ @param {Options} [options] markdown-it options.
1972
+ */
1973
+ function markdown(input: string, options?: MarkdownItOptions): string;
1974
+
1975
+ /**
1976
+ Prevent widow words inside a tag by adding a `&nbsp;` between its last two words.
1977
+
1978
+ @param {string} html The HTML string to render.
1979
+ @param {WidowWordsConfig} [options] Options to pass to the transformer.
1980
+ */
1981
+ function preventWidows(html: string, options?: WidowWordsConfig): string;
1982
+
1983
+ /**
1984
+ Duplicate HTML attributes to inline CSS.
1985
+
1986
+ @param {string} html The HTML string to render.
1987
+ @param {AttributeToStyleSupportedAttributes} [options] Options to pass to the transformer.
1988
+ */
1989
+ function attributeToStyle(
1990
+ html: string,
1991
+ options?: AttributeToStyleSupportedAttributes[]
1992
+ ): string;
1993
+
1994
+ /**
1995
+ Inline CSS styles from `<style>` tags found in `<head>`.
1996
+
1997
+ @param {string} html The HTML string to render.
1998
+ @param {InlineCSSConfig} [options] Options to pass to the transformer.
1999
+ */
2000
+ function inlineCSS(html: string, options?: InlineCSSConfig): string;
2001
+
2002
+ /**
2003
+ Rewrite longhand CSS inside style attributes with shorthand syntax.
2004
+ Only works with margin, padding and border, and only when all sides are specified.
2005
+
2006
+ @param {string} html The HTML string to render.
2007
+ */
2008
+ function shorthandCSS(html: string): string;
2009
+
2010
+ /**
2011
+ Remove unused CSS from `<style>` tags and HTML elements.
2012
+
2013
+ @param {string} html The HTML string to use.
2014
+ @param {RemoveUnusedCSSConfig} [options] Options to pass to the transformer.
2015
+ */
2016
+ function removeUnusedCSS(html: string, options?: RemoveUnusedCSSConfig): string;
2017
+
2018
+ /**
2019
+ Automatically remove HTML attributes.
2020
+ @param {string} html The HTML string to use.
2021
+ @param options Either an array of attribute names, or an array of objects with `name` and `value` properties.
2022
+ */
2023
+ function removeAttributes(
2024
+ html: string,
2025
+ options?:
2026
+ | string[]
2027
+ | Array<{
2028
+ name: string;
2029
+ value: string | RegExp;
2030
+ }>
2031
+ ): string;
2032
+
2033
+ /**
2034
+ Add attributes to elements in your HTML.
2035
+
2036
+ @param {string} html The HTML string to use.
2037
+ @param {object} options Attributes to add.
2038
+ */
2039
+ function addAttributes(html: string, options?: Record<string, unknown>): string;
2040
+
2041
+ /**
2042
+ Pretty print HTML code so that it's nicely indented and more human-readable.
2043
+ @param {string} html The HTML string to prettify.
2044
+ @param {CoreBeautifyOptions} [options] Options to pass to the prettifier.
2045
+ */
2046
+ function prettify(html: string, options?: CoreBeautifyOptions): string;
2047
+
2048
+ /**
2049
+ Prepend a string to sources and hrefs in an HTML string.
2050
+
2051
+ @param {string} html The HTML string to use.
2052
+ @param {BaseURLConfig} [options] Options to pass to the transformer.
2053
+ */
2054
+ function applyBaseURL(html: string, options?: string | BaseURLConfig): string;
2055
+
2056
+ /**
2057
+ Append parameters to URLs in an HTML string.
2058
+ @param {string} html The HTML string to use.
2059
+ @param {URLParametersConfig} [options] Options to pass to the transformer.
2060
+ */
2061
+ function addURLParameters(html: string, options?: URLParametersConfig): string;
2062
+
2063
+ /**
2064
+ Ensure that all your HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
2065
+
2066
+ @param {string} html The HTML string to use.
2067
+ */
2068
+ function ensureSixHex(html: string): string;
2069
+
2070
+ /**
2071
+ Minify a string of HTML code.
2072
+
2073
+ @param {string} html The HTML string to minify.
2074
+ @param {MinifyConfig} [options] Options to pass to the minifier.
2075
+ */
2076
+ function minify(html: string, options?: MinifyConfig): string;
2077
+
2078
+ /**
2079
+ Batch-replace strings in an HTML string.
2080
+
2081
+ @param {string} html The HTML string to use.
2082
+ @param {object} replacements Strings to find and replace.
2083
+ */
2084
+ function replaceStrings(html: string, replacements?: Record<string, string>): string;
2085
+
2086
+ /**
2087
+ Generate a plaintext version of an HTML string.
2088
+
2089
+ @param {string} html The HTML string to use.
2090
+ @param {PlaintextConfig} [options] Options to pass to the plaintext generator.
2091
+ */
2092
+ function plaintext(html: string, options?: PlaintextConfig): Promise<{
2093
+ html: string;
2094
+ plaintext: string;
2095
+ destination: string;
2096
+ }>;
2097
+
2098
+ export {
2099
+ // Configurations
2100
+ Config,
2101
+ RenderOptions,
2102
+ RenderOutput,
2103
+ LayoutsConfig,
2104
+ TemplatesConfig,
2105
+ ComponentsConfig,
2106
+ ExpressionsConfig,
2107
+ TailwindConfig,
2108
+ BrowsersyncConfig,
2109
+ PostHTMLConfig,
2110
+ BuildConfig,
2111
+ InlineCSSConfig,
2112
+ RemoveUnusedCSSConfig,
2113
+ URLParametersConfig,
2114
+ AttributeToStyleSupportedAttributes,
2115
+ WidowWordsConfig,
2116
+ MinifyConfig,
2117
+ MarkdownConfig,
2118
+ BaseURLConfig,
2119
+ PlaintextConfig,
2120
+ // Functions
2121
+ render,
2122
+ safeClassNames,
2123
+ markdown,
2124
+ preventWidows,
2125
+ attributeToStyle,
2126
+ inlineCSS,
2127
+ shorthandCSS,
2128
+ removeUnusedCSS,
2129
+ removeAttributes,
2130
+ addAttributes,
2131
+ prettify,
2132
+ applyBaseURL,
2133
+ addURLParameters,
2134
+ ensureSixHex,
2135
+ minify,
2136
+ plaintext,
2137
+ replaceStrings
2138
+ };
2139
+ }
2140
+
2141
+ export = MaizzleFramework;