@maizzle/framework 5.0.0-beta.34 → 5.0.0-beta.35
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 +1 -1
- package/src/server/index.js +6 -1
- package/types/config.d.ts +60 -13
- package/types/css/inline.d.ts +0 -36
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -62,7 +62,7 @@ async function renderUpdatedFile(file, config) {
|
|
|
62
62
|
spinner.start('Building...')
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Add
|
|
65
|
+
* Add current template path info to the config
|
|
66
66
|
*
|
|
67
67
|
* Can be used in events like `beforeRender` to determine
|
|
68
68
|
* which template file is being rendered.
|
|
@@ -178,6 +178,11 @@ export default async (config = {}) => {
|
|
|
178
178
|
// Set the file being viewed
|
|
179
179
|
viewing = filePath
|
|
180
180
|
|
|
181
|
+
// Add current template path info to the config
|
|
182
|
+
config.build.current = {
|
|
183
|
+
path: path.parse(filePath),
|
|
184
|
+
}
|
|
185
|
+
|
|
181
186
|
// Read the file
|
|
182
187
|
const fileContent = await fs.readFile(filePath, 'utf8')
|
|
183
188
|
|
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
|
*
|