Skip to content

Useful template literal tag for create html strings in ES2015+

License

Notifications You must be signed in to change notification settings

denomod/deno_html

Repository files navigation

deno_html

tag Build Status license

Useful template literal tags for create html/css strings in ES2015+.

Usage

import { html } from "https://deno.land/x/html/mod.ts";

let languages = ["Rust", "JavaScript", "TypeScript"];

const str = html`
  <div class="list">
    <ul>
      ${languages.map((x) => `<li>${x}</li>`)}
    </ul>
  </div>
`;

console.log(str);

Outputs:

<div class="list">
  <ul>
    <li>Rust</li>
    <li>JavaScript</li>
    <li>TypeScript</li>
  </ul>
</div>

Why not template literal?

License

deno_html is released under the MIT License. See the bundled LICENSE file for details.