0.2.0 • Published 2 years ago
@binyamin/eleventy-preact v0.2.0
@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
orfalse
) - This will register a shortcode with the given name, which renders a JSX file in-place. Setting it tofalse
disables the shortcode. The shortcode takes two parameters. The first is a file path, relative to theincludes
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.