https://github.com/edde746/vite-plugin-mjml
Import .mjml files with Vite
https://github.com/edde746/vite-plugin-mjml
Last synced: 12 months ago
JSON representation
Import .mjml files with Vite
- Host: GitHub
- URL: https://github.com/edde746/vite-plugin-mjml
- Owner: edde746
- Created: 2025-06-23T21:23:19.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-23T21:26:54.000Z (12 months ago)
- Last Synced: 2025-06-23T21:30:59.602Z (12 months ago)
- Language: JavaScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# vite-plugin-mjml
A Vite plugin that allows you to import MJML files and automatically compiles them to HTML.
## Installation
```bash
npm install @edde746/vite-plugin-mjml mjml
```
## Usage
Add the plugin to your `vite.config.js`:
```js
import { defineConfig } from 'vite';
import { mjmlPlugin } from '@edde746/vite-plugin-mjml';
export default defineConfig({
plugins: [mjmlPlugin()]
});
```
Then you can import MJML files directly in your JavaScript/TypeScript code:
```js
import emailHtml from './email.mjml';
// emailHtml contains the compiled HTML string
document.body.innerHTML = emailHtml;
```
## Example
Check the `example/` directory for a complete working example.