Skip to content

Instantly share code, notes, and snippets.

@JeanCollas
Last active November 5, 2018 13:28
Show Gist options
  • Save JeanCollas/e5b69011e2edd478da9266fdc5fabd9d to your computer and use it in GitHub Desktop.
Save JeanCollas/e5b69011e2edd478da9266fdc5fabd9d to your computer and use it in GitHub Desktop.
HTML javascript templating
<!-- To combine with https://gist.github.com/DanDiplo/30528387da41332ff22b -->
<script>
const renderULLI = (data) => `<ul>${data.map(li => `<li>${li}</li>`).join('')}</ul>`;
document.body.innerHTML=renderULLI(['Hi!','line2','line 3'])
</script>
<!-- might be improved for template updates with https://github.com/Polymer/lit-html -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment