thepassle / generic-components

A collection of generic web components with a focus on accessibility, and ease of use
https://genericcomponents.netlify.app/
MIT License
557 stars 29 forks source link

Highlight HTML in tagged template literals #68

Open JosefJezek opened 2 years ago

JosefJezek commented 2 years ago

Could you add highlight HTML in tagged template literals?

const html = String.raw; // or const html = str => str[0];
const template = html`<div></div>`;
thepassle commented 2 years ago

Why?

JosefJezek commented 2 years ago

Fo better reading... Github and VS Code support html``.

thepassle commented 2 years ago

This project doesnt really use tagged template literals though. Why would you want this project to ship something like this?

JosefJezek commented 2 years ago

tagged template literals are supported by GitHub and VS Code for code highlighting...

example from generic-accordion

template.innerHTML = html`
  <style>
    ::slotted(button) {
      display: block;
      width: 100%;
    }
    :host {
      display: block;
    }
  </style>
  <slot>
  </slot>
`;