Skip to content

Instantly share code, notes, and snippets.

@pure
Created October 14, 2010 20:40
Show Gist options
  • Save pure/627007 to your computer and use it in GitHub Desktop.
Save pure/627007 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>PURE Unobtrusive Rendering Engine</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script src="http://github.com/pure/pure/raw/master/libs/pure.js">
</script>
</head>
<body>
<!-- HTML template -->
<div class="template">
Hello <a></a>
</div>
<!-- result place -->
<div class="result"></div>
<script>
var jsonData = {
who:'BeeBole!',
site:'http://beebole.com'
};
//select the template
$('div.template')
//map the HTML with the JSON data
.directives({ 'a':'who', 'a@href':'site' })
//generate the new HTML
.render(jsonData)
//place the result in the DOM, using any jQuery command
.appendTo('div.result');
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment