@komefumi/html-template-tag
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Simple HTML Template Tag

A simple utility function. Bundled for different environments using Rollup, and making use of TypeScript.

Usage

First install:

npm install @komefumi/html-template-tag

Usage is as follows:

import html from "simple-html-template-tag";

const interpolated = 450;
const resulted = html`<h1>${interpolated}</h1>`;

The Advantage

You get HTML syntax highlighting, formatting, and everything else that your text editor supports if it recognizes the html tag to mean the associated string to be in HTML. This allows the building of raw HTML strings within JavaScript.

To take advantage of this support (easily provided in VSCode), you have to import the package function as html, as you see in the example above.

i.e.,

import html from "simple-html-template-tag";

And not

import somethingElse from "simple-html-template-tag";

More notes

Partially also a learning project, feel free to use the code as you see fit!

Package Sidebar

Install

npm i @komefumi/html-template-tag

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

11 kB

Total Files

15

Last publish

Collaborators

  • komefumi