
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
render-tmpl
Advanced tools
render-tmplUse <template> as a rendering engine, < 100 lines of code.
data-s-{text,attr,show} for use with <template> elements.<template data-s-tmpl="tmpl">
<div data-s-text="greeting"></div>
<img data-s-attr="src=url,alt=greeting" />
</template>
<script type="importmap">
{ "imports": { "render-tmpl": "https://esm.sh/render-tmpl" } }
</script>
<script type="module">
import { renderTmpl } from "render-tmpl";
document.appendChild(
renderTmpl(document.querySelector("[data-s-tmpl=tmpl]"), {
greeting: "hello",
url: "my-url",
}),
);
</script>
data-s-tmpldata-s-tmpl is a convention to denote templates that will be used with render-tmpl.
Usage: <template data-s-tmpl="loading"></template>.
data-s-showdata-s-show will set display: none; if the expression is false and will unset display if it's true.
Usage: <div data-s-show="isShown"></div>
Use of negation is allowed with !, eg. <div data-s-show="!isLoading"></div>, note: any arbitrary number of ! works, but other boolean logic (&&, ||, ()) will not work, this is because the value is not eval-ed as JavaScript.
data-s-textSet the textContent of the node to the value of the referenced variable.
Usage: <p data-s-text="message"></p>
data-s-attrSet attributes on the element based on provided key-value attr1=value1,attr2=value2 pairs.
Aliases: data-s-attrs
Usage: <img data-s-attr="src=url,alt=greeting" /> sets src and alt attributes to the values contained in url and greeting variables.
data-s-slotUsed as the element into which sub-templates are injected.
Usage:
<template data-s-tmpl="tmpl">
<div data-s-slot></div>
<template data-s-tmpl="no-results">
No Results <span data-s-text="requestId"></span>
</template>
</template>
<script type="module">
import { renderTmpl } from "render-tmpl";
document.appendChild(
renderTmpl(document.querySelector("[data-s-tmpl=tmpl]"), {}, (tmpl) =>
renderTmpl(tmpl.querySelector("[data-s-tmpl=no-results]"), {
requestId: "1234",
}),
),
);
</script>
npm install installs all required dependencies.npm test will run tests using the Node.js test runner and the node:test module.npm run format will run prettier on all the examples files (and tests).Code is licensed under the MIT License.
FAQs
Use `<template>` as a rendering engine, < 100 lines of code.
We found that render-tmpl demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.