nuxt-mjml-web

4.7.0 • Public • Published

nuxt-mjml-web

npm

Browser-compatible mjml module for NuxtJS.

Installation

You can install nuxt-mjml-web with your npm client of choice.

$ npm install --save-dev nuxt-mjml-web

Usage

Add nuxt-mjml-web to the buildModules section of nuxt.config.js.

export default {
  buildModules: ['nuxt-mjml-web'],
}

The module depends on mjml-web and takes care of isolating the bundle into its own chunk. It also prevents minification from breaking mjml component registration.

import mjml2html, { registerComponent } from 'mjml-web'
 
registerComponent(MyComponent)
mjml2html('<mjml>...</mjml>')

Keep in mind that the bundle isn't compatible with server-side rendering. You should only import mjml-web in a client-only context. You can use dynamic imports to only load mjml when you need it.

const { default: mjml2html, registerComponent } = await import('mjml-web')
 
registerComponent(MyComponent)
mjml2html('<mjml>...</mjml>')

License - MIT

Package Sidebar

Install

npm i nuxt-mjml-web

Weekly Downloads

3

Version

4.7.0

License

MIT

Unpacked Size

3.56 kB

Total Files

4

Last publish

Collaborators

  • vberlier