Eleventy plugin that injects Declarative Shadow DOM into <grigson-chart> elements at build time.
Charts are fully visible before any JavaScript runs — useful for static sites and environments where JS may be slow to load or disabled.
import grigsonPlugin from 'eleventy-plugin-grigson';
export default function (eleventyConfig) {
eleventyConfig.addPlugin(grigsonPlugin);
}The plugin registers an Eleventy transform (grigson-dsd) that post-processes every .html output file. For each <grigson-chart> element without an existing <template shadowrootmode>, it:
- Resolves the chart source from an inline
<template>or an external template referenced byid - Parses and renders the chart using
parseSongandHtmlRendererfromgrigson - Respects the
normalise,transpose-key, andtranspose-semitonesattributes - Supports explicit
<grigson-html-renderer>children with per-renderer configuration - Injects the rendered HTML as
<template shadowrootmode="open">inside the element - Emits
@font-faceCSS into<head>(once per page) so notation fonts load correctly
Charts with unrecognised renderer children (e.g. <grigson-text-renderer>) are skipped.