You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Shipping with 3.0.0-alpha.15. Pass in the raw JavaScript as the virtual template content, like so:
eleventyConfig.addTemplate("virtual.11ty.js",function(data){return`this is a test ${data.page.url}.`;});eleventyConfig.addTemplate("virtual.11ty.js",{data: ()=>({var: 2}),render: function(data){return`this is a test ${data.var}.`;}});
Activity
zachleat commentedon Jul 4, 2024
Shipping with 3.0.0-alpha.15. Pass in the raw JavaScript as the virtual template content, like so:
VividVisions commentedon Jul 5, 2024
Awesome! So, I guess using JS classes as templates (with
dataandrendermethods) will also be as easy as this:zachleat commentedon Jul 5, 2024
@VividVisions any of the 11ty.js types would work there: https://www.11ty.dev/docs/languages/javascript/
Fixes 11ty#3347
Docs for 11ty/buildawesome#3347
zachleat commentedon Sep 26, 2024
Temporary docs preview URL building here: https://11ty-website-git-v3-11ty.vercel.app/docs/virtual-templates/#javascript