@maizzle/framework 4.7.6 → 4.8.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 +4 -4
- package/src/commands/serve.js +1 -1
- package/src/generators/output/to-disk.js +16 -12
- package/types/templates.d.ts +38 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maizzle/framework",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"postcss-merge-longhand": "^6.0.0",
|
|
61
61
|
"posthtml": "^0.16.6",
|
|
62
62
|
"posthtml-attrs-parser": "^0.1.1",
|
|
63
|
-
"posthtml-base-url": "^2.0.
|
|
63
|
+
"posthtml-base-url": "^2.0.2",
|
|
64
64
|
"posthtml-component": "^1.1.0",
|
|
65
65
|
"posthtml-content": "^1.0.2",
|
|
66
66
|
"posthtml-extend": "^0.6.0",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"posthtml-fetch": "^3.0.0",
|
|
69
69
|
"posthtml-markdownit": "^1.3.1",
|
|
70
70
|
"posthtml-match-helper": "^1.0.3",
|
|
71
|
-
"posthtml-mso": "^2.0.
|
|
72
|
-
"posthtml-postcss-merge-longhand": "^2.0
|
|
71
|
+
"posthtml-mso": "^2.0.1",
|
|
72
|
+
"posthtml-postcss-merge-longhand": "^2.1.0",
|
|
73
73
|
"posthtml-safe-class-names": "^3.0.0",
|
|
74
74
|
"posthtml-url-parameters": "^2.0.0",
|
|
75
75
|
"pretty": "^2.0.0",
|
package/src/commands/serve.js
CHANGED
|
@@ -107,7 +107,7 @@ const serve = async (env = 'local', config = {}) => {
|
|
|
107
107
|
let ext = ''
|
|
108
108
|
|
|
109
109
|
if (Array.isArray(config.build.templates)) {
|
|
110
|
-
const match = config.build.templates.find(template =>
|
|
110
|
+
const match = config.build.templates.find(template => path.parse(file).dir.includes(path.normalize(template.source)))
|
|
111
111
|
source = path.normalize(get(match, 'source'))
|
|
112
112
|
dest = path.normalize(get(match, 'destination.path', 'build_local'))
|
|
113
113
|
ext = get(match, 'destination.ext', 'html')
|
|
@@ -209,22 +209,26 @@ module.exports = async (env, spinner, config) => {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
const assets =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
const assets = Array.isArray(get(templateConfig, 'assets'))
|
|
213
|
+
? get(templateConfig, 'assets')
|
|
214
|
+
: [{source: '', destination: 'assets', ...get(templateConfig, 'assets')}]
|
|
215
|
+
|
|
216
|
+
for await (const asset of assets) {
|
|
217
|
+
if (Array.isArray(asset.source)) {
|
|
218
|
+
for await (const source of asset.source) {
|
|
219
|
+
if (fs.existsSync(source)) {
|
|
220
|
+
await fs
|
|
221
|
+
.copy(source, path.join(templateConfig.destination.path, asset.destination))
|
|
222
|
+
.catch(error => spinner.warn(error.message))
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
if (fs.existsSync(asset.source)) {
|
|
217
227
|
await fs
|
|
218
|
-
.copy(source, path.join(templateConfig.destination.path,
|
|
228
|
+
.copy(asset.source, path.join(templateConfig.destination.path, asset.destination))
|
|
219
229
|
.catch(error => spinner.warn(error.message))
|
|
220
230
|
}
|
|
221
231
|
}
|
|
222
|
-
} else {
|
|
223
|
-
if (fs.existsSync(assets.source)) {
|
|
224
|
-
await fs
|
|
225
|
-
.copy(assets.source, path.join(templateConfig.destination.path, assets.destination))
|
|
226
|
-
.catch(error => spinner.warn(error.message))
|
|
227
|
-
}
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
await glob(path.join(templateConfig.destination.path, '/**').replace(/\\/g, '/'))
|
package/types/templates.d.ts
CHANGED
|
@@ -75,35 +75,49 @@ export default interface TemplatesConfig {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
* Source and destination directories for your asset files.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```
|
|
82
|
+
* module.exports = {
|
|
83
|
+
* build: {
|
|
84
|
+
* templates: {
|
|
85
|
+
* assets: {
|
|
86
|
+
* source: 'src/images',
|
|
87
|
+
* destination: 'images'
|
|
88
|
+
* }
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
94
|
assets?: {
|
|
95
95
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
* Directory where Maizzle should look for asset files.
|
|
97
|
+
*
|
|
98
|
+
* @default ''
|
|
99
|
+
*/
|
|
100
100
|
source?: string;
|
|
101
101
|
/**
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
* Directory where asset files should be copied to.
|
|
103
|
+
*
|
|
104
|
+
* @default 'assets'
|
|
105
|
+
*/
|
|
106
106
|
destination?: string;
|
|
107
|
+
} | {
|
|
108
|
+
/**
|
|
109
|
+
* An array of objects specifying source and destination directories for asset files.
|
|
110
|
+
*/
|
|
111
|
+
assets: Array<{
|
|
112
|
+
/**
|
|
113
|
+
* Directory where Maizzle should look for asset files.
|
|
114
|
+
*/
|
|
115
|
+
source: string;
|
|
116
|
+
/**
|
|
117
|
+
* Directory where asset files should be copied to.
|
|
118
|
+
*/
|
|
119
|
+
destination: string;
|
|
120
|
+
}>;
|
|
107
121
|
};
|
|
108
122
|
|
|
109
123
|
/**
|