Add preview support to generated templates

Add preview support to generated templates