@maizzle/framework 5.0.0-beta.34 → 5.0.0-beta.36
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 +2 -2
- package/src/server/index.js +8 -3
- package/types/config.d.ts +60 -13
- package/types/css/inline.d.ts +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maizzle/framework",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.36",
|
|
4
4
|
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"posthtml": "^0.16.6",
|
|
75
75
|
"posthtml-attrs-parser": "^1.1.1",
|
|
76
76
|
"posthtml-base-url": "^3.1.4",
|
|
77
|
-
"posthtml-component": "
|
|
77
|
+
"posthtml-component": "next",
|
|
78
78
|
"posthtml-content": "^2.1.0",
|
|
79
79
|
"posthtml-expressions": "^1.11.4",
|
|
80
80
|
"posthtml-extra-attributes": "^3.1.0",
|
package/src/server/index.js
CHANGED
|
@@ -41,6 +41,7 @@ app.use(hmrRoute)
|
|
|
41
41
|
let viewing = ''
|
|
42
42
|
const spinner = ora()
|
|
43
43
|
let templatePaths = []
|
|
44
|
+
const serverStartTime = Date.now()
|
|
44
45
|
|
|
45
46
|
function getTemplateFolders(config) {
|
|
46
47
|
return Array.isArray(get(config, 'build.content'))
|
|
@@ -62,7 +63,7 @@ async function renderUpdatedFile(file, config) {
|
|
|
62
63
|
spinner.start('Building...')
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
* Add
|
|
66
|
+
* Add current template path info to the config
|
|
66
67
|
*
|
|
67
68
|
* Can be used in events like `beforeRender` to determine
|
|
68
69
|
* which template file is being rendered.
|
|
@@ -178,6 +179,11 @@ export default async (config = {}) => {
|
|
|
178
179
|
// Set the file being viewed
|
|
179
180
|
viewing = filePath
|
|
180
181
|
|
|
182
|
+
// Add current template path info to the config
|
|
183
|
+
config.build.current = {
|
|
184
|
+
path: path.parse(filePath),
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
// Read the file
|
|
182
188
|
const fileContent = await fs.readFile(filePath, 'utf8')
|
|
183
189
|
|
|
@@ -390,7 +396,6 @@ export default async (config = {}) => {
|
|
|
390
396
|
const maxRetries = get(config, 'server.maxRetries', 10)
|
|
391
397
|
|
|
392
398
|
function startServer(port) {
|
|
393
|
-
const serverStartTime = Date.now()
|
|
394
399
|
const server = createServer(app)
|
|
395
400
|
|
|
396
401
|
/**
|
|
@@ -411,7 +416,7 @@ export default async (config = {}) => {
|
|
|
411
416
|
)
|
|
412
417
|
|
|
413
418
|
spinner.stopAndPersist({
|
|
414
|
-
text:
|
|
419
|
+
text: `\n${pico.bgBlue(` Maizzle v${version} `)} ready in ${pico.bold(Date.now() - serverStartTime)} ms`
|
|
415
420
|
+ '\n\n'
|
|
416
421
|
+ ` → Local: http://localhost:${port}`
|
|
417
422
|
+ '\n'
|
package/types/config.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type WidowWordsConfig from './widowWords';
|
|
|
12
12
|
import type { CoreBeautifyOptions } from 'js-beautify';
|
|
13
13
|
import type { BaseURLConfig } from 'posthtml-base-url';
|
|
14
14
|
import type URLParametersConfig from './urlParameters';
|
|
15
|
+
import type { PostCssCalcOptions } from 'postcss-calc';
|
|
15
16
|
import type { PostHTMLFetchConfig } from 'posthtml-fetch';
|
|
16
17
|
import type { Config as TailwindConfig } from 'tailwindcss';
|
|
17
18
|
import type { PostHTMLComponents } from 'posthtml-component';
|
|
@@ -41,7 +42,7 @@ export default interface Config {
|
|
|
41
42
|
* }
|
|
42
43
|
* ```
|
|
43
44
|
*/
|
|
44
|
-
add?: Record<string, Record<string, string|number>>;
|
|
45
|
+
add?: Record<string, Record<string, string | number>>;
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* Remove attributes from elements.
|
|
@@ -110,6 +111,52 @@ export default interface Config {
|
|
|
110
111
|
*/
|
|
111
112
|
purge?: PurgeCSSConfig;
|
|
112
113
|
|
|
114
|
+
/**
|
|
115
|
+
* Resolve CSS `calc()` expressions to their static values.
|
|
116
|
+
*/
|
|
117
|
+
resolveCalc?: boolean | PostCssCalcOptions;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Resolve CSS custom properties to their static values.
|
|
121
|
+
*/
|
|
122
|
+
resolveProps?: boolean | {
|
|
123
|
+
/**
|
|
124
|
+
* Whether to preserve custom properties in the output.
|
|
125
|
+
*
|
|
126
|
+
* @default false
|
|
127
|
+
*/
|
|
128
|
+
preserve?: boolean | 'computed';
|
|
129
|
+
/**
|
|
130
|
+
* Define CSS variables that will be added to :root.
|
|
131
|
+
*
|
|
132
|
+
* @default {}
|
|
133
|
+
*/
|
|
134
|
+
variables?: {
|
|
135
|
+
[key: string]: string | {
|
|
136
|
+
/**
|
|
137
|
+
* The value of the CSS variable.
|
|
138
|
+
*/
|
|
139
|
+
value: string;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the variable is !important.
|
|
142
|
+
*/
|
|
143
|
+
isImportant?: boolean;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Whether to preserve variables injected via JS with the `variables` option.
|
|
148
|
+
*
|
|
149
|
+
* @default true
|
|
150
|
+
*/
|
|
151
|
+
preserveInjectedVariables?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether to preserve `@media` rules order.
|
|
154
|
+
*
|
|
155
|
+
* @default false
|
|
156
|
+
*/
|
|
157
|
+
preserveAtRulesOrder?: boolean;
|
|
158
|
+
};
|
|
159
|
+
|
|
113
160
|
/**
|
|
114
161
|
* Normalize escaped character class names like `\:` or `\/` by replacing them
|
|
115
162
|
* with email-safe alternatives.
|
|
@@ -129,40 +176,40 @@ export default interface Config {
|
|
|
129
176
|
safe?: boolean | Record<string, string>;
|
|
130
177
|
|
|
131
178
|
/**
|
|
132
|
-
*
|
|
179
|
+
* Rewrite longhand CSS inside style attributes with shorthand syntax.
|
|
180
|
+
* Only works with `margin`, `padding` and `border`, and only when
|
|
181
|
+
* all sides are specified.
|
|
133
182
|
*
|
|
134
|
-
* @default
|
|
183
|
+
* @default []
|
|
135
184
|
*
|
|
136
185
|
* @example
|
|
137
186
|
* ```
|
|
138
187
|
* export default {
|
|
139
188
|
* css: {
|
|
140
|
-
*
|
|
189
|
+
* shorthand: {
|
|
190
|
+
* tags: ['td', 'div'],
|
|
191
|
+
* } // or shorthand: true
|
|
141
192
|
* }
|
|
142
193
|
* }
|
|
143
194
|
* ```
|
|
144
195
|
*/
|
|
145
|
-
|
|
196
|
+
shorthand?: boolean | Record<string, string[]>;
|
|
146
197
|
|
|
147
198
|
/**
|
|
148
|
-
*
|
|
149
|
-
* Only works with `margin`, `padding` and `border`, and only when
|
|
150
|
-
* all sides are specified.
|
|
199
|
+
* Ensure that all your HEX colors inside `bgcolor` and `color` attributes are defined with six digits.
|
|
151
200
|
*
|
|
152
|
-
* @default
|
|
201
|
+
* @default true
|
|
153
202
|
*
|
|
154
203
|
* @example
|
|
155
204
|
* ```
|
|
156
205
|
* export default {
|
|
157
206
|
* css: {
|
|
158
|
-
*
|
|
159
|
-
* tags: ['td', 'div'],
|
|
160
|
-
* } // or shorthand: true
|
|
207
|
+
* sixHex: false,
|
|
161
208
|
* }
|
|
162
209
|
* }
|
|
163
210
|
* ```
|
|
164
211
|
*/
|
|
165
|
-
|
|
212
|
+
sixHex?: boolean;
|
|
166
213
|
|
|
167
214
|
/**
|
|
168
215
|
* Use a custom Tailwind CSS configuration object.
|
package/types/css/inline.d.ts
CHANGED
|
@@ -163,24 +163,6 @@ export default interface InlineCSSConfig {
|
|
|
163
163
|
*/
|
|
164
164
|
customCSS?: string | false;
|
|
165
165
|
|
|
166
|
-
/**
|
|
167
|
-
* Resolve CSS variables and replace them with their values.
|
|
168
|
-
*
|
|
169
|
-
* @default true
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```
|
|
173
|
-
* export default {
|
|
174
|
-
* css: {
|
|
175
|
-
* inline: {
|
|
176
|
-
* resolveVariables: true
|
|
177
|
-
* }
|
|
178
|
-
* }
|
|
179
|
-
* }
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
resolveVariables?: boolean;
|
|
183
|
-
|
|
184
166
|
/**
|
|
185
167
|
* Remove inlined CSS selectors from the `<style>` tag.
|
|
186
168
|
*
|
|
@@ -198,24 +180,6 @@ export default interface InlineCSSConfig {
|
|
|
198
180
|
*/
|
|
199
181
|
removeInlinedSelectors?: boolean;
|
|
200
182
|
|
|
201
|
-
/**
|
|
202
|
-
* Resolve calc() expressions in CSS to their computed values.
|
|
203
|
-
*
|
|
204
|
-
* @default true
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```
|
|
208
|
-
* export default {
|
|
209
|
-
* css: {
|
|
210
|
-
* inline: {
|
|
211
|
-
* resolveCalc: true
|
|
212
|
-
* }
|
|
213
|
-
* }
|
|
214
|
-
* }
|
|
215
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
resolveCalc?: boolean;
|
|
218
|
-
|
|
219
183
|
/**
|
|
220
184
|
* Prefer unitless CSS values
|
|
221
185
|
*
|