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
import{html,render}from'https://unpkg.com/htm/preact/standalone.mjs';const{ cx }=benefit()// ! TODO Make this a utility of benefitconststyleWithHtml=(...args)=>{constvdom=html(...args);(functionreplaceClassWithBenefit(vdom){if(vdom.attributes&&vdom.attributes.class){vdom.attributes.class=cx(vdom.attributes.class)}if(vdom.children){vdom.children.forEach((child)=>replaceClassWithBenefit(child))}})(vdom);returnvdom}constvdom=styleWithHtml` <main class="antialiased">Howdy</main> `render(vdom,document.body)```Obviously, what we'd like to do is have a wrapper kinda like:```import{html,render}from'https://unpkg.com/htm/preact/standalone.mjs';const{ styleWithHtml }=benefit()conststyled=styleWithHtml(html)constvdom=styled`...````
The text was updated successfully, but these errors were encountered:
In #16, I found that it's pretty trivial to automatically instrument https://github.com/developit/htm's
vdom
output to use benefit.The rough code is:
The text was updated successfully, but these errors were encountered: