- 21 Feb 2025
- 1 Minute to read
- Print
Create a Template - Basic
- Updated on 21 Feb 2025
- 1 Minute to read
- Print
Boilerplate templates provide a foundation for creating Dise templates, eliminating the need to start from scratch. They come pre-loaded with essential elements, which can be easily customized and expanded to suit your specific needs.
See the Boilerplate Templates guide for more information.
Copy a Boilerplate Template
It’s recommended to create a new folder for new, custom built templates. This folder should be located alongside the ‘Boilerplates’, ‘PlayerSimulator’ and ‘Samples’ folders.
Select a suitable ‘Boilerplates’ template. The ‘SimpleMediaTemplate’ is recommended to help get started.
Copy the entire folder of the selected boilerplate template to the new folder you created for your templates.
Rename the folder, css and ts files to an appropriate new name.
Create a copy of the ‘Debug.html’ and rename it to ‘template.html’.
Open the ‘template.html’ and remove the meta tags as described by the comments in the file’s code, ensuring the stylesheet and script are referenced correctly.
Create a ‘deployment’ folder in the root of the template folder. You can reference a sample template in the ‘Samples’ folder for an example folder structure.
Create a template.json file in the newly created ‘deployment’ folder, the sample manifest can be used as an example.
Add build and zip scripts to the ‘package.json’ found in the root folder alongside the main ‘index.html’ file, replacing the relevant names within the <>.
"build-<templateName>": "cd <template/folder/location> && tsc -p . & lessc css/<templateName>.less css/<templateName>.css & lessc --clean-css css/<templateName>.less css/<templateName>.min.css",
"zip-<templateName>": "node build/zipDiseTemplate.js <template/folder/location> <templateName>-CX.zip CX"
The template is mainly created in the TypeScript (.ts) file that was renamed in the steps above.
It is advised to read through the remaining guides in the Template SDK before creating a custom template.
Build the Template
Ensure the build and zip scripts have been added, see above steps.
Run
npm run build-<templateName>
, replacing <templateName> with the relevant name of the template.The build script will compile the TypeScript and CSS.
Run
npm run zip-<templateName>
, replacing <templateName> with the relevant name of the template.The zip script will compress all relevant files into a zip for upload to the CX Portal.