Skip to content
DOM building utility & Template engine based on JsonML + syntax sugar
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Build Status

A DOM building utility and Template engine build upon JsonML with syntax sugar.

Checkout for an extensive documentation.


		['h1#logo', 'Static Example'],
		['p','Some example text'],
			['li', 'item1'],
			['', 'item2'],
				['a', 'item3', {href: '#'}]
		['em', 'Important', {
			style: {
				color: 'red',
				'font-size': '2em',

compiles to

	<h1 id="logo">Static Example</h1>
	<p>Some example text</p>
	<ul id="list" class="bullets">
		<li class="active">item2</li>
		<li><a href="#">item3</a></li>
	<em style="color:red;font-size:2em">Important</em>

In order to convert HTML fragments to shaven arrays html2shaven can be used.


  • Syntax Sugar for ids, classes and variable caching
  • Support for namespaces. (Lets you build SVGs and other XML based languages)
  • Callback functions on elements
  • Returns a Object containing the root element and the elements with an id


  • Leverage the full power of JavaScript in your templates. => No need to learn a new language!
  • Directly integrable into JavaScript files
  • Works in front- and backend environment
  • Templates normally tend to get more complicated with the number of variables as they need to get escaped in some way. With Shaven it's exactly the opposite. As variables are native to Shaven the templates get simpler with an increasing number of variables.
  • Shaven templates can be easily build with every major programming language and their existing JSON/YAML tools.


npm install --save shaven

Check out for a detailed description of how to install shaven in other environments.

Browser Support

  • Firefox: 20+
  • Opera: 21+
  • Chrome: 34+
  • Safari: 9+ (Does not correctly escape HTML strings in attributes)
  • IE: ? (Probably 9+. Please submit a pull request if you know more.)
  • Edge (EdgeHTML): 12+

Earlier Firefox, Opera and Chrome versions have the same bug as Safari. That means even much older versions will just work fine under normal circumstances.


Check if code changes must be made in the server and browser version of shaven

  • Tests: $ npm test
  • Build: $ npm run build
  • Bump version
    1. Change version number in package file (semver)
    2. Execute npm run prepublish
    3. Commit
    4. Tag commit (v<version>)
  • Publish to npm $ npm publish
  • Release new version of website:
     git checkout gh-pages
     rm -rf index.html scripts
     mv site/* .
     git commit
     git push
You can’t perform that action at this time.