compile html file to js function