Generate from template file