1.0.3 • Published 4 years ago

preact-mjml-types v1.0.3

Weekly downloads
63
License
MIT
Repository
github
Last release
4 years ago

Preact MJML types

A quick and dirty hack to allow mj-* tags and corresponding attributes in Preact TSX (as intrinsic elements, not components).

Installation

npm install preact-mjml-types

Usage

import { h } from 'preact';
import 'preact-mjml-types'; // *must* go after 'preact'

import { render } from 'preact-render-to-string';
import mjml2html = require('mjml');

import { userInfo } from 'os';

const mjmlVNodes = <mjml>
    <mj-body>
        <mj-section background-color="white">
            <mj-text>This seems to work, {userInfo().username}!</mj-text>
        </mj-section>
    </mj-body>
</mjml>;

const mjmlCode = render(mjmlVNodes);
console.log(mjmlCode);

const result = mjml2html(mjmlCode);
console.log(result.html);

License

MIT

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago