0.3.2 • Published 6 months ago

webatvantage-vite-plugin-mjml v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

 

Usage

Install vite-plugin-mjml and add it to your Vite configuration:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import laravel from 'vite-plugin-laravel'
import mjml from 'vite-plugin-mjml'

export default defineConfig({
	plugins: [
		laravel(),
		vue(),
		mjml({
			input: 'resources/mail',
			output: 'resources/views/emails',
			extension: '.blade.php',
		}),
	],
})

When running vite dev, all .mjml files in your input directory will be compiled to output when saved. Similarly, when building for production, all files in input will be compiled as well.

For instance, resources/mail/onboarding/welcome.mjml would be written to resources/views/emails/onboarding/welcome.blade.php.

 

Options

OptionTypeDescriptionDefault
inputstringPath to the directory in which .mjml files are storedsrc/mjml
viewsstringPath to views directory in which .mjml files are recompiled when ng-includes are edited.src/mjml/views
outputstringPath to the directory in which compiled files will be writtenmailings
extensionstringExtension that will be used by compiled .mjml files.html
mjmlMJMLParsingOptionsSpecific MJML compiler options{}
watchbooleanWhether to watch and compile on the fly in development modetrue
logbooleanWhether to print output in the consoletrue