Signagelive Widget Builder

A complete solution to package and build a ready for distribution widget for Signagelive.

Installation

Overview

The Signagelive Widget Builder will simplify your development workflow, making it easier to build and package widgets for use with Signagelive. It handles the creation of the config.xml file and creation of the widget file.

Quick Setup Guide

The Signagelive Widget Builder builds your widget based upon the information stored in package.json

  1. Starting with a basic package.json (yours maybe a little different to the example), set the namedescriptionversionauthor and licence keys to values appropriate for your widget.
  1. Set the main key to the entry point for your widget (usually index.html):
  1. Add the scripts key to package.json per the example below, (this will allow you to easily build it using the CLI)
  1. Add the widgetConfig key to package.json. This is where we start to extend package.json to include information specifically for the Signagelive Widget:
  1. Set the display name of your widget, you can use either the name key in package.json or displayName key on widgetConfig.

The key difference is that in the displayName key you can include spaces whereas the name key must conform to the package.json specification.

  1. It’s best practice to include a thumbnail of your widget that will display in the Signagelive media asset library, this can be added to the widgetConfig object:

Usage

Running npm run dist, this will create a new folder in the root directory of your widget called dist and a versioned .wgt file.

Widget Preferences

It is possible to include an array of preferences in your widget, please see the developer documentation developer documentation for more information on preference usage.

Preferences are easy to add to your widget.

  1. Add a preferences key set to any empty array to the widgetConfig key
  1. Add the individual preferences (in the order you wish them to display in Signagelive) e.g.:

You can use the following data types:

  • string
  • int
  • float
  • datetime
  • colour
  • boolean
  • list
  1. Optionally add validation to your preferences:

You can use the following validators, please see the full developer documentation for further details.

ValidatorValuesNotes
readonlytrue or falseCan be used on any preference type
requiredtrue or falseCan be used on any preference type
patternThis specifies a regular expression that can be used to validate the stringApplies to string preference types only
minlengthAn integer value representing the minimum length of the stringApplies to string preference types only
maxlengthAn integer value representing the maximum length of the stringApplies to string preference types only
stingtypeemail, url or alphanumValidates that the string is the predetermined type
minAn integer value representing the minimum value of the preferenceApplies to int and float preference types only
maxAn integer value representing the maximum value of the preferenceApplies to int and float preference types only
rangeA range of integer values. The format is be: [6,10], where 6 is the min value and 10 is the maxApplies to int and float preference types only
setA pipe separated list of allowed valuesApplies to list preference types only

Advanced Usage

Distinct Config Files

It is possible to specify the widget config in a seperate file, and pass this to the widget builder using the command line.

The JSON file format is the same as the widgetConfig object that can be included in the package.json file however it is possible to specify the name of the output widget file by setting a name key.

This feature is useful for using the same base widget to build multiple widgets by chaining the commands:

"scripts": {
"dist": "signagelive-widget-builder --config=<path to config 1> && signagelive-widget-builder --config=<path to config 2>"
},


To pass the config file to the widget builder the format is signagelive-widget-builder --config=<path to config>

Themes

If you are using the same basic widget you can create theme folders to use in conjunction with the Distinct Config File feature to copy resources such as images, css, scripts etc to your widget.

All you need to do is specify a theme name on the route of the configuration object, create a themes folder with a sub folder for the theme and all resources will be copied to the root of the widget that is built.