Skip to content

webthusiast/htjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

htjs

A simple internal DSL for constructing HTML with JS.

Demo

Clone from git, execute

$ npm install
$ npm start

... and navigate to http://localhost:8000/demo.html.

Usage

$ npm install htjs

And

var htjs = require('htjs');
var form = htjs('form', {method: 'POST', action: '.'}, [
	htjs('input', {type: 'text', name: 'username'}),
	htjs('input', {type: 'password', name: 'password'}),
	htjs('input', {type: 'submit'}),
]);
element.appendChild(form);

Coffeescript gives you a more readable layout:

$ = require 'htjs'
documentFragment = $ [
	$ null, 'a text node'
	$ 'div', [
		$ 'div' # an empty div
	]
]

About

A simple internal DSL for constructing HTML with JS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published