vue-email / nuxt

💚 Official Nuxt module for Vue Email. Build email templates with Vue components.
https://vuemail.net/getting-started/nuxt-nitro
MIT License
109 stars 3 forks source link

feat: SSR as it should be #47

Closed Flowko closed 3 months ago

Flowko commented 4 months ago

Ability to just use vue components as normal, so importing or doing any other extra stuff, should work fine out of the box ( if vue supports it, it should work, if not then it wont). we will be dropping the compiler library as we wont be supporting it anymore. Note that this doesnt use any custom compiler other than what vue provides, also there might be some limitations in importing vue files on the server side, but its doable.

Related 🔗:

https://github.com/vue-email/vue-email/pull/177

Breaking Changes 🔔:

Fixes:

Tests:

Playground:

if you wanna check the new integration, note that its using a new edge package, but that will be changed back to the live version once published https://github.com/Flowko/nuxt-playground

Changes:

// /api/test.post.ts
import { useRender } from 'vue-email-edge'
import Email from '../../components/Email.vue'

export default defineEventHandler(async (event) => {
  const html = await useRender(Email, {
    userFirstName: 'John',
    loginDevice: 'Chrome on Mac OS X',
    loginLocation: 'Upland, California, United States',
    loginIp: '00.000.00.000',
    loginDate: new Date('September 7, 2022, 10:58 am'),
  })

  return html.html
})