Skip to content

csakaszamok/ibh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ibh (itsy-bitsy html template)

A very simple html template for you

Basic usage example:

<body>
  <template id="my-template">
    <div>{{myVariable}}</div>
  </template>
</body>

<script type="module">  
  import Ibh from 'https://cdn.jsdelivr.net/gh/csakaszamok/ibh/dist/ibh-0.1.0.min.js';
  const elem1 = Ibh.cloneTemplate({selector: '#my-template', variables: { myVariable: "What's up ?" } })
  document.appendChild(elem1)
</script>

Output:

What's up ?

Arrays example:

<body>
  <template id="my-template">
    <div>{{myVariable}}</div>
  </template>
</body>

<script type="module">  
  import Ibh from 'https://cdn.jsdelivr.net/gh/csakaszamok/ibh/dist/ibh-0.1.0.min.js';
  const arr = [ {myVariable: 'This is one'}, {myVariable: 'This is two'} ]
  const selector = '#my-template'
  arr.map( item => document.appendChild(  Ibh.cloneTemplate({selector, variables: item }) )    
</script>

Output:

This is one
This is two

About

itsy-bitsy html template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published