generate  code with template file