https://github.com/vberlier/nuxt-mjml-web
Browser-compatible mjml module for NuxtJS.
https://github.com/vberlier/nuxt-mjml-web
browser mjml nuxt nuxt-module
Last synced: 30 days ago
JSON representation
Browser-compatible mjml module for NuxtJS.
- Host: GitHub
- URL: https://github.com/vberlier/nuxt-mjml-web
- Owner: vberlier
- License: mit
- Created: 2020-06-20T08:55:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-28T20:00:47.000Z (over 4 years ago)
- Last Synced: 2025-08-30T08:53:01.584Z (about 1 month ago)
- Topics: browser, mjml, nuxt, nuxt-module
- Language: JavaScript
- Homepage:
- Size: 15.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nuxt-mjml-web
[](https://www.npmjs.com/package/nuxt-mjml-web)
> Browser-compatible [mjml](https://github.com/mjmlio/mjml) module for NuxtJS.
## Installation
You can install `nuxt-mjml-web` with your `npm` client of choice.
```bash
$ npm install --save-dev nuxt-mjml-web
```## Usage
Add `nuxt-mjml-web` to the `buildModules` section of `nuxt.config.js`.
```js
export default {
buildModules: ['nuxt-mjml-web'],
}
```The module depends on [mjml-web](https://github.com/vberlier/mjml-web) and takes care of isolating the bundle into its own chunk. It also prevents minification from breaking mjml component registration.
```js
import mjml2html, { registerComponent } from 'mjml-web'registerComponent(MyComponent)
mjml2html('...')
```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.
```js
const { default: mjml2html, registerComponent } = await import('mjml-web')registerComponent(MyComponent)
mjml2html('...')
```---
License - [MIT](https://github.com/vberlier/nuxt-mjml-web/blob/master/LICENSE)