npm

custom-html-tag

1.0.0 • Public • Published

custom-html-tag

usage

<script src="node_modules/custom-html-tag/html.js"></script>
<script src="node_modules/custom-renderer/render.js"></script>
<script>
  const html = new HTMLTag();
  const span = document.createElement('span');
  const template = html`<p>${'variable'}</p>`;
  render(span, template, {variable: 'hello'}); // <p>hello</p>
  render(span, template, {variable: 'hello world'}); // <p>hello world</p>
  
  // or
  // without custom-renderer
  const templateResult = template({variable: 'hello'});
  templateResult.changes.forEach(change => {
    change.from.value // previous value
    change.from.position // previous position
    change.to.value // new value
    change.to.position // new position
    // check https://github.com/vandeurenglenn/custom-renderer for an working example.
  });
</script>

Readme

Keywords

none

Package Sidebar

Install

npm i custom-html-tag

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

3.95 kB

Total Files

7

Last publish

Collaborators

  • vandeurenglenn