compile html template to javascript object