多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
844 B

import {createEmailClient} from "vue-extensible-mail";
import components from "./templates/components";
import assets from "./templates/assets";
import * as fs from "node:fs";
import decode from 'html-entities-decoder';
const emailClient = createEmailClient({
path: "./src/templates",
components: {
...components,
...assets
},
});
const exportString = 'export default `'
if (fs.existsSync("./.dist")) {
fs.rmdirSync("./.dist", {recursive: true});
}
for (const file of fs.readdirSync("./src/templates")) {
if (file.endsWith(".vue")) {
const markup = decode(await emailClient.renderEmail(file, {}, {}))
if (!fs.existsSync("./.dist")) {
fs.mkdirSync("./.dist");
}
fs.writeFileSync(`./.dist/${file.replace(".vue", ".ts")}`, exportString + markup + "`")
}
}