Closed zachleat closed 2 years ago
this
this.alt
this.src
<script webc:type="render" webc:is="template"> function() { if(!this.alt) { throw new Error("oh no you didn’t"); } // Free idea: use the Eleventy Image plugin to return optimized markup return `<img src="${this.src}" alt="${this.alt}">`; } </script>
function()
This was solved by #73
this
for prop/data/attr reference optional. Similar to https://github.com/11ty/webc/issues/40 but for https://www.11ty.dev/docs/languages/webc/#webctyperender-(javascript-render-functions). Seethis.alt
andthis.src
below:function()
altogether! Again reusing the work for #40