Hacker GitHub

← All repos

developit/htm

View on GitHub ↗ ★ 9,050 JavaScript

Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.

58 mentions on Hacker News by 44 people: 6 stories, 52 comments · first 2018-11-21 · latest 2026-08-05

Mentions per year 58 mentions · busiest year 2020 (15)
20082026
  1. > Bonus points at scale you invent a templating solution. Maybe you use JSX FYI this exists https://github.com/developit/htm which couples well with preact browser only (no npm/node compilation)
  2. …common but few libraries use that to support JSX-like syntax at runtime, without a build step. e.g. https://github.com/developit/htm and https://lit.dev/docs/components/rendering/
    comment by jsheard · 2026-01-09 · in JavaScript Demos in 140 Characters
  3. …below). This jsx discussion seems more about removing the compile step, which you can do with https://github.com/developit/htm import { createElement as m } from "your-jsx-compatible-library"; var ListComponent = () => { let count = 0,…
  4. …browser import jsx from "react/jsx" const App = () => jsx!(<div>>Foo</div>) Projects like this : https://github.com/developit/htm are an expression/symptom of that need
    comment by apatheticonion · 2025-09-16 · in React is winning by default and slowing innovation
  5. …libraries. We sort of get around this today using template literals and eval, but it's janky. https://github.com/developit/htm A generic macro system could open the door to a framework like Svelte, Angular, Vue, etc being able to embed…
  6. …convention as well [2]. [1] https://github.com/ryansolid/dom-expressions/tree/7fd9f86f1b... [2] https://github.com/developit/htm
    comment by throwitaway1123 · 2025-07-01 · in What should a native DOM templating API look like?
  7. …add anything to simplify DOM handling, which is why libraries like Lit exist. -- 1: Inspired by https://github.com/developit/htm
    comment by emmanueloga_ · 2024-11-30 · in If not React, then what?
  8. For a practical example of this technique used in JS take a look at libraries like htm and lit-html: https://github.com/developit/htm
  9. …want to use React as _just_ a `<script>` tag with no build step, I'd recommend also using https://github.com/developit/htm to at least give you JSX-like syntax for writing your components.
  10. …also dislikes transpiling jsx so they've developed an alternative using tagged template literals: https://github.com/developit/htm
  11. You can use the htm library as a pure client-side jsx: https://github.com/developit/htm It is not completely the same, but far better than that h function madness.
    comment by Joeri · 2023-11-13 · in HTML Web Components
  12. …"HTM" is a JSX like javascript string template representation of HTML, and it can be found here: https://github.com/developit/htm -- it is used by rehtm, which is the OP. It's a confusing collection of names at first sight.
    comment by skygazer · 2023-06-25 · in Create and Hydrate HTML with HTM
  13. …no custom syntax for js variable, so @attribute something when you must pass an object as props. 0. https://github.com/developit/htm
  14. …be compiled away in a build step) https://preactjs.com/guide/v10/getting-started#alternatives-... https://github.com/developit/htm
  15. …some of the few nicities JSX has, but which are actually compatible with the official language. [1] https://github.com/developit/htm
  16. You can also use preact without a build step via htm https://github.com/developit/htm#installation
    comment by forsakenharmony · 2022-10-05 · in Templating in HTML
  17. …electron apps before, and I have to say, Tauri really feels snappier. [0] https://preactjs.com/ [1] https://github.com/developit/htm
  18. …just a limitation of JSX. [1]: https://lit.dev/playground/#project=W3sibmFtZSI6InNpbXBsZS1n... [2]: https://github.com/developit/htm
    comment by amadeuspagel · 2022-07-14 · in Statements vs. Expressions
  19. …components in plain javascript files and import them. Bliss for me. [0] https://preactjs.com/ [1] https://github.com/developit/htm Edit: Just read that you want drag & drop style UI building, so this might not be for you.
  20. …add on here, the Preact author made a generalized utility for tagged template => vnode conversions: https://github.com/developit/htm
  21. ▲ 1
    HTM: JSX alternative using standard tagged templates, with compiler support
    story by memorable · 2022-05-19 · 0 comments
  22. You might find this interesting: https://github.com/developit/htm#readme
  23. …of JSX I’ve been using htm, which fulfills roughly the same role but runs entirely in the browser: https://github.com/developit/htm I find typescript useful for libraries, less so for application code.
    comment by Joeri · 2021-11-17 · in Some notes on using esbuild
  24. …Compiler[4] works better. [0]: https://developer.mozilla.org/ [1]: https://preactjs.com/ [2]: https://github.com/developit/htm [3]: https://svelte.dev/ [4]: https://developers.google.com/closure/compiler/
  25. …too. Cool! -1: https://github.com/TimDaub/web3-sign-msg - 2: https://docs.ficusjs.org/ -3: https://github.com/developit/htm
    comment by timdaub · 2021-05-05 · in How we use web components
  26. …- no build tools required! Btw there's vscode support for this so you get syntax hilight too https://github.com/developit/htm
  27. …very close to native web components) [1] - Svelte (the darling of many since recently) [2] [0] - https://github.com/developit/htm [1] - https://lit-element.polymer-project.org/ [2] - https://svelte.dev/
    comment by azangru · 2021-03-28 · in FicusJS
  28. Here I am again. Stop using JSX and start embracing Javascript's template strings. They're awesome! https://github.com/developit/htm
  29. …small. And with preact/compat you can use any third party react component. I'm a particular fan of https://github.com/developit/htm , which is an alternative to JSX that simply uses JS template strings and needs no preprocessor.
  30. …you really hate transpilers/tools). Most of them are outdated or not actual "Improvements". [1]: https://github.com/developit/htm#improvements-over-jsx
    comment by mumblerino · 2020-09-22 · in New JSX Transform
  31. …Tagged Markup) instead of JSX and I love it. It's just plain JS and works extremely similar to JSX: https://github.com/developit/htm
    comment by timdaub · 2020-09-22 · in New JSX Transform
  32. ▲ 1
    Hyperscript, a Better JSX
    story by ausjke · 2020-09-22 · 1 comment
  33. In this case, you could use `htm`: https://github.com/developit/htm#usage
    comment by lhnz · 2020-09-18 · in Vue.js 3
  34. …that's generally unwieldy and almost no one does that. However, there's a very neat library called https://github.com/developit/htm , which is an almost-JSX-compatible syntax that uses JS template literal strings, and requires no compile…
    comment by acemarke · 2020-09-18 · in Vue.js 3
  35. …only targeting modern browsers with ES6 support you can even use `import from` statements. [1] https://github.com/developit/htm
    comment by ratww · 2020-09-16 · in On Modern Web Applications Stability
  36. …paragraph that you linked, is a very clever alternative, similar to jsx but in pure javascript [1] https://github.com/developit/htm
  37. ah, and the article also mentioned https://github.com/developit/htm which pretty much provides what JSX does, just in a lot less complex way (at the cost of a little run-time)
  38. …where I want to add some interactivity without involving the rest of the nightmarish JS ecosystem. https://github.com/developit/htm
    comment by bschwindHN · 2020-06-22 · in A little bit of plain JavaScript can do a lot
  39. htm and vhtml from @developit. https://github.com/developit/htm https://github.com/developit/vhtml
  40. …better and only add 5kB of Javascript to your site instead of leaving an unmaintainable mess. [0] https://github.com/developit/htm
    comment by imtringued · 2020-06-19 · in Advice to Young Web Developers
  41. …needing to compile to hyperscript first (but you should compile during production builds) 1. https://github.com/developit/htm 2. https://lit-html.polymer-project.org/guide
  42. …possible to use htm with Preact for developing without a bundler if your target users support ES6. https://github.com/developit/htm
  43. …Htm (JSX in string templates) which doesn't need a build step either and is much smaller than Vue. https://github.com/developit/htm
    comment by pier25 · 2020-04-14 · in Using VueJS Alongside Django
  44. …the compilation step you can use htm (also originally by the same author of the blog and Preact): https://github.com/developit/htm
    comment by uhryks · 2019-09-28 · in Modern Script Loading
  45. …you could replace the default template strings with something using tagged template literals (like https://github.com/developit/htm ). You can work around nesting by spinning up new components after the innerHTML assignment, and assigning…
  46. …They both look like they accomplish the same goal but HTM's implementation looks smaller. [1] https://github.com/developit/htm
    comment by sdegutis · 2019-06-21 · in Why I don't use web components
  47. yup, just add the script tag and you're good to go! It's frequently used along with https://github.com/developit/htm for a jsx-less template syntax. No build tools required :)
    comment by mhagemeister · 2019-06-15 · in JavaScript Is the CO2 of the Web [audio]
  48. …library is a great alternative: nearly-JSX syntax via template strings, with no compilation needed: https://github.com/developit/htm
    comment by acemarke · 2019-05-19 · in Virtual DOM is pure overhead (2018)
  49. …`htm` library seems to be a very nice alternative to JSX that does not require a build step: https://github.com/developit/htm
  50. …viable alternative to JSX in many ways. [0] https://github.com/jador/react-hyperscript-helpers [1] https://github.com/developit/htm