twixt-document Function var doc = require("twixt-document"); doc(function(document) { document.getElementById("foo"); }); Custom Document var doc = require("twixt-document")(document); doc(function(document) { // document is the document passed to the require above });