Hacker News new | past | comments | ask | show | jobs | submit login

Not the parent commenter, but I have an app whose web components inherit from a class with this constructor:

  constructor(html) {
    super();
    const link = document.createElement("link");
    link.rel = "stylesheet";
    link.href = "/theme.css";
    const template = document.createElement("template");
    template.innerHTML = html;
    this.attachShadow({ mode: "open" }).append(link, template.content);
  }
Global things like vars, default typography, and input style resets go in theme.css.



Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: