Skip to content
/ ANSIdom Public

a DOM implementation in ANSI escape codes, render HTML to your terminal

Notifications You must be signed in to change notification settings

Marak/ANSIdom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ANSIdom v0.0.1

a quick and dirty DOM implementation in ANSI escape codes

share templates between the browser and the terminal

note: the current DOM implementation is a hack, at best. expect it to break, badly.

Live Demo

browser demo http://ohh.io/ANSIdom

terminal demo

 curl ohh.io/ANSIdom

these both share the same HTML template

Installation

 npm install ANSIdom

Usage

var ANSIdom = require('../lib/ANSIdom').ANSIdom,
    fs      = require('fs');

var dom = new ANSIdom();

var template = fs.readFileSync('./templates/index.html').toString();

dom.init(function(err){
  
  if (err) {
    throw err;
  }

  //
  // Note: `process` can be any streamable interface, like httpServer.response
  //
  dom.render(template, process);

});

Examples

see: /bin/ folder for some demos

MIT

About

a DOM implementation in ANSI escape codes, render HTML to your terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published