
Announcements
Hello community,
I'm setting up a portal from scratch and I was wondering what's best practice, using Web files or Web Templates?
I've read that before you can use web files you have to delete the '.js' extension from your blocked file extensions. Does this have disadvantages? Everyone can therefore start uploading JavaScript files, this does not feel secure.
But on the other hand, separate files seem more convenient.
I'm planning on making a JavaScript bundle by using Typescript. If I would use Web Templates should I create 1 template file for the whole bundle?
It would be interesting to know the advantages and disadvantages of both.
Thanks in advance !
Regards,
Justine
Hi @JustineS ,
Web Templates and Web Files have a completely different purpose. Web Files are using to store your portal assets (css, js, images). And Web Templates provide you with actual HTML code for your pages. You, of course, can write a js code as a part of your Web Template (and you often will) but is not a most reusable scenario if you want to use that code in multiple places.
Regarding js extension - yes by default you cannot use js files as attachments and you will need to remove it from System Settings. However, it is just one of the approaches. Another commonly used approach is to switch extension of your js files to something like .es or .myjs (or literally anything else) and upload it that way to the system.
Regarding best practices, I would advise checking this blog post from Arpit Shrivastava.