This is an introductory guide describes how to use the Player Simulator as a test and debug environment for Dise templates. More information and detail can be found in the Player Simulator guide.
The Player Simulator is a light-weight implementation of the Dise Player API, suitable for running and debugging templates in a stand-alone environment, i.e. outside of the normal CMS/Player system. The dynamic data which would normally come from the CMS needs to be provided in local “mock” files.
Access the Player Simulator directly or use the below steps to set up a developer environment for Dise One templates:
Prerequisites
Install Visual Studio Code - https://code.visualstudio.com/.
Install the ‘Live Server’ extension from the VS Code marketplace.
Install git - https://git-scm.com/downloads.
Install Node.js or ensure the latest version is installed - https://nodejs.org/en.
Clone the Dise Repository and Submodules
Open a terminal.
Run
git clone --recursive https://bitbucket.org/diseinc/sampletemplates.gitNavigate to the newly created ‘sampletemplates’ folder using
cd sampletemplatesInstall TypeScript:
Open a terminal.
Run
npm installRun
npm install typescript -g
Run a Sample Project in the Player Simulator
Select the ‘index.html’ file in the root of the ‘samplestemplates’ folder.
Locate
const template = templates.Samples.<sampleTemplate>(usually found around line 40).The <sampleTemplate> should be replaced with the sample template to be run in the Dise Simulator.
The name of all available sample templates can be found just above
const template = templates.Samples.<sampleTemplate>in the ‘index.html’.
Navigate to the sample template folder to be run in the Dise Simulator:
E.g.
cd .\Samples\Info\
Compile the template:
Run
tsc -p . -w
Start the Player Simulator by right-clicking on the ‘index.html’ and selecting ‘Open with Live Server’.