User Tools

Site Tools

Translations of this page?:

en:template:start

Templates

Template in Geckos are the heart of the engine. Without it, no card can be edited. But what is a Template exactly, and how can you make your own ?

Template's Overview

A template is a JSON object. It's a way of formatting information so that the engine of Geckos understand it. To create such a file, simply create a text file, with for example the name myTemplate.json. Here's the skeleton of the file :

template-base.json
 {
    "description": { },
    "fonts" : [ ],
    "webfonts": { },
    "sharedOptions": [ ],
    "styles" : [ ],
    "globals": [ ]
 };

Description

Description of the template is stored in a description object. Currently, four items can be set :

"description": 
  { 
    "description": "Basic template for Pulp Alley", 
    "title":"Pulp Alley", 
    "credits": "by Nicolas Ronvel", 
    "url": "https://github.com/Gulix/geckos/"
  },

These informations are displayed in the Template part of the UI, when a Template has been loaded.

Custom Fonts

The fonts element in the template is optional. Any template will work even if it's missing.

If you need specific font inside your template, that you're not sure the users will have them installed on their computer, then it's a good idea to use this part of the template.

See Custom Fonts for an explanation on how to add a font to your template.

Webfonts

The webfonts element in the template is optional. Any template will work even if it's missing.

If you need specific font inside your template, and that it's available on a web library, you can reference it. It will be loaded from the library by the user's browser.

See Web Fonts for an explanation on how to add a web-font to your template.

Shared Options

This part is described in the Dropdown Menu page.

Styles

The styles part of a template stores the elements that will generate the image. It includes the size of the card, the editable fields, the card elements, …

Each template can include numerous styles (for different languages, with different design but same data, …), and that's why styles is an array of different styles.

See the Styles section for a more complete description of a Style.

Globals

The globals part of a template stores data that is repeated through the template, and that can be put in a single global constant, in order to help maintainability.

See the Globals for an explanation on how to add globals to your template.

en/template/start.txt · Last modified: 2017/06/22 11:02 by Nicolas Ronvel