Hello guys! does anyone know what is the best prac...
# suitecommerce
e
Hello guys! does anyone know what is the best practice for templates on 2019.2? I mean, I see that all the files now have an extension like: *tpl.d.ts however they are only exporting a variable and I am not sure how they are taking the content of the template and also, could it be possible to use just *.tpl in a new module?
s
Are you writing TypeScript?
e
Yes! I am writing TypeScript and trying to use pageType non-CMS
by the way this is a custom module, old school, not a extension
s
I figured 🙂
Well, if you don't create definition files for your templates and you reference them in your files, you should get an error when you try to compile the TypeScript
The definition files tell TypeScript that there is a template file and not to worry
I believe future versions of SCA will not require developers to do this, but I cannot guarantee it
e
so, what I need to do is:
///<amd-module name="my_custom_module.tpl"/>
declare var x:any;
export = x;
write the above in my_custom_module.tpl.d.ts
and then create my_custom_module.tpl in the Theme folder?
s
Generally yes, in a view.
e
OK, sounds good! I may need to deploy the new template in order to test locally, it would be a great article explaining this stuff in the blog! maybe it is not a big deal if you have worked before with SCA but it may be confused for someone new, thanks for your help!
s
I had started writing something about TypeScript but its exposure is still quite limited and so I pulled it before I finished.
We are focused on promoting extensions, themes and the extensibility API and SuiteCommerce right now, so I don't really have the time to dive deep into it.
e
I got it!