Been playing with simple web components recently for some codewithhugo.com pages Found it a bit painful to do templating (`.innerHTML` or `.appendChild` friendly options) Open sourced 2 utils that I couldn't find a lightweight existing package for (`lit-html` seems heavy handed in this case)
Post
codewithhugo.comCode with HugoNode.js and JavaScript Guides - Build your web platform with modern best-practices & tools
`html-esc`: A template literal tag which escapes interpolated values github.com/HugoDF/html-... `render-tmpl`: A `<template>` based HTML templating library ("directives" to make it easy to inject values and attributes into your template) github.com/HugoDF/rende...
github.comGitHub - HugoDF/render-tmpl: Use `<template>` as a rendering engine, < 100 lines of code.Use `<template>` as a rendering engine, < 100 lines of code. - HugoDF/render-tmpl
Yeah so I didn't want to borrow the v-bind/x-bind shorthand because I explicitly am not doing a reactive binding Re why it's `data-s-attr="attrName=contextValue"` 1. The querySelectorAll is simpler (select for data-s-attr), I'm not even sure how I would use querySelect for "attrs starting with :"
0 reposts1 like