Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tr-domify with all npm packages installed. Try it out:

require("domify/package.json"); // domify is a peer dependency. var trDomify = require("tr-domify")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tr-domify v0.1.0

Browserify transform module for requiring html files through domify.

tr-domify

Browserify transform module for requiring html files through domify.

Usage

With npm do:

npm install tr-domify

This will also install domify as a peerDependency.

Then in your browser code you can do:

var template = require('./templates/example.html');
var el = template.cloneNode(true);

so you get a DOM object you can clone, ready to insert into the DOM.

To know more about Browserify transforms

https://github.com/substack/node-browserify#btransformopts-tr

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free