convert smartjs template to function compiled