๐ vue-email
Simple way to build email templates in vue.
Features
Setup
๐ Read the documentation
pnpm add -D vue-email
npm i -D vue-email
Basic Usage
๐ Read the documentation
// components/template-email.vue
<template>
<e-html lang="en">
<e-text>Hello, {{ user }}!</e-text>
<e-hr />
<e-button href="vuejs.org">Visit vue</e-button>
</e-html>
</template>
<script setup>
import { EButton, EHr, EHtml, EText } from 'vue-email';
import { ref } from 'vue';
const user = ref('Dave');
</script>
You can see the full example here
Advanced Usage - SSR
๐ Read the SSR documentation
import express from "express";
import { config } from "vue-email/compiler";
const app = express();
const vueEmail = config("./templates", {
verbose: false,
options: {
baseUrl: "https://vue-email-demo.vercel.app/",
},
});
app.get("/", async function (req, res) {
const template = await vueEmail.render("WelcomeEmail.vue", {
props: {
name: "John Doe",
},
});
res.send(template);
});
app.listen(3000);
๐ป Development
- Clone this repository
- Enable Corepack using
corepack enable
- Install dependencies using
pnpm install
Contributors
Repo Activity
๐ Annotations
This project is inspired by react-email
License
This project is licensed under MIT