scan and parser template source to js function.