Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aaronpowell/glue

Glue will stick your objects into your HTML
https://github.com/aaronpowell/glue

Last synced: about 1 month ago
JSON representation

Glue will stick your objects into your HTML

Awesome Lists containing this project

README

        

# Glue!

Glue is a micro templating library which uses the HTML5 data attributes to make HTML from your template.

Here's how you create a Glue template:


<h1 data-glue-name></h1>



$('#glue').glue([ { name: 'Glue tastes good' } ]).appendTo($('#body'));


Glue also allows you to set attributes rather than the innerHTML of an element:


<h1 data-glue-name='title'>Psst, check out the title</h1>



$('#glue').glue([ { name: 'Glue tastes good' } ]).appendTo($('#body'));


# Why Glue?

I don't like templating libraries which require their own syntax like `${SomeProperty}`, and I don't see why you should hijack an existing property like `class` to specify your template operation. Instead Glue will take `data-glue-*` and map that into your objects property.