@binyamin/eleventy-preact

0.2.0 • Public • Published

@binyamin/eleventy-preact

A personal Eleventy plugin for rendering JSX/TSX as HTML, with Preact.

Usage

Add the plugin to your eleventy config, like so:

const eleventyPreact = require("@binyamin/eleventy-preact");

module.exports = function(eleventyConfig) {
    eleventyConfig.addPlugin(eleventyPreact, {
        /* options */
    });
}

Customization

  • doctype (boolean) - Determines whether to add a doctype (<!DOCTYPE HTML>) before the rendered HTML. The doctype is never applied to JSX rendered via the shortcode.
  • shortcode (string or false) - This will register a shortcode with the given name, which renders a JSX file in-place. Setting it to false disables the shortcode. The shortcode takes two parameters. The first is a file path, relative to the includes directory. The second is an object, passed as props.

These are the default options:

{
    doctype: true,
    shortcode: "render_jsx"
}

Contributing

All input is welcome; feel free to open an issue. Please remember to be a mensch. If you want to program, you can browse the issue list.

Legal

All source-code is provided under the terms of the MIT license. Copyright 2022 Binyamin Aron Green.

Package Sidebar

Install

npm i @binyamin/eleventy-preact

Weekly Downloads

3

Version

0.2.0

License

MIT

Unpacked Size

8.69 kB

Total Files

6

Last publish

Collaborators

  • b3u