diff --git a/examples/custom-elements/.eleventy.js b/examples/custom-elements/.eleventy.js
new file mode 100644
index 0000000..31084f0
--- /dev/null
+++ b/examples/custom-elements/.eleventy.js
@@ -0,0 +1,82 @@
+const transformDomPlugin = require('eleventy-plugin-transformdom');
+
+
+
+// generate transformers for transformDomPlugin
+function getElementTransformer(selector, options = {}) {
+
+ const defaultOptions = {
+ name: 'div',
+ attributes: (e => Object.fromEntries(Array.from(e.attributes).map(a => [a.name, a.value]))),
+ class: (e => e.localName), // lowercase tag name
+ };
+ options = Object.assign(defaultOptions, options);
+
+ const getName = (
+ (typeof options.name == 'function') ? (e => options.name(e)) :
+ (() => options.name)
+ );
+
+ const getAttributes = (
+ (typeof options.attributes == 'function') ? (e => options.attributes(e)) :
+ (typeof options.attributes == 'object') ? (() => options.attributes) :
+ (() => false)
+ );
+
+ const getExtraClass = (
+ (typeof options.class == 'function') ? (e => options.class(e)) :
+ (typeof options.class == 'string') ? (() => options.class) :
+ (() => false)
+ );
+
+ const domTransformer = {
+ selector,
+ transform: ({ elements, document }) => {
+ for (const element of elements) {
+ const nameNew = getName(element);
+ if (!nameNew) continue; // no replace
+ const attributesNew = getAttributes(element) || {};
+ const extraClassNew = getExtraClass(element);
+
+ const elementNew = document.createElement(nameNew);
+
+ // copy attributes
+ for (const [name, value] of Object.entries(attributesNew)) {
+ elementNew.setAttribute(name, value);
+ }
+
+ // copy content
+ elementNew.innerHTML = element.innerHTML;
+
+ // add class
+ if (extraClassNew) elementNew.classList.add(extraClassNew);
+
+ element.replaceWith(elementNew);
+ }
+ },
+ };
+ return domTransformer;
+}
+
+
+
+module.exports = function (eleventyConfig) {
+ const domTransformers = [];
+
+ // in:
+