User Tools

Site Tools

Translations of this page?:

en:tutorial:tutorial03

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

===== How to create & edit your own templates ? ===== If the [[tutorial01|first Tutorial]] explains the basics of the template creation, this tutorial is aimed at the file organization when creating and editing your template. ==== File directory for templates ==== The ''json'' files for the templates are all stored in the ''src/js/templates/'' directory. Yours should go there too. Subdirectories are possible. Just create your own template, for example ''myowntemplate.json''. You can start from scratch ([[tutorial01|follow the tutorial]]), or copy an existing template to serve as a base (a good way to start, in my opinion). ==== Referencing your template ==== A single file in the project references all the templates that are presented by Geckos. It's the file ''src/js/templates/load-templates.js''. If you're on Windows, after creating the ''json'' file for your template, you can just launch the script ''generate-requirejs-template.vbs''. It will generate the ''load-template.js'' file with all the templates in the directory. You can also edit the file. It's a simple one : <code javascript load-templates.js> define([ 'json!templates/templates01.json', 'json!templates/myowntemplate.json' ], function( tpl1, tpl2) { return { load: function() { var list = [ ]; list.push(tpl1); list.push(tpl2); return list; } }; }); </code>

en/tutorial/tutorial03.1510492451.txt.gz · Last modified: 2017/11/12 14:14 by Nicolas Ronvel