node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

mkdom

mkdom

mkdom converts HTML into DOM elements in browsers and on the server. It makes writing shared rendering logic fairly easy.

Build status

Browser support

install

npm install mkdom

use

var fs = require('fs')
var mkdom = require('mkdom')
var html = fs.readFileSync('./templates/readme.html')
 
var page = mkdom(html)
page.querySelector('h1').textContent = 'mkdom'
page.querySelector('p').textContent = 'mkdom converts pl…'
 
process.stdout.write(page.outerHTML)

obey

MIT