Template(Tmplt) & Customization

Template(Tmplt) & Customization

When a new project is created in Kwik4, you find ‘tmplt‘ folder in your project folder. Now build folder is named as ‘build4′ with Kwik4 when you publish a project.

You can open a Kwik3 project in Kwik4 then from Project and Pages > Project properties, you can click Update Tmplt in publish tab to make ‘tmplt’ folder.

build4 folder is newly structured. Each layer on photoshop is published to a single lua file. For instance, Hello_World layer is published to components/page01/Hello_World_image_.lua

Published image

Template File

Let me explain how kwik publishes a lua file. If you press publish button, Kwik internally process each layer with your project(.kwk) and generates images and lua files. Kwik4 reads the following template files while publishing lua files. For instance, Hello_World_image_.lua is created with layerX_image.lua which receives the values of Hello_Word layer.

layerX_image.lua is a mustache file. http://mustache.github.io/ {{myLName}}, {{mX}}, {{mY}} are tags expanded by values of model data of a layer on photoshop

You can modify a template file at your risk. For instance, let’s add a filter to layerX_image.lua. At line 82-83, filter.scatter is added with scaled by twice.

Filterd image

Customizing Files

If modify a template file of a component, for instance image, it is applied to all the same components of kwik. All image layers use layerX_image.lua and you don’t want to apply filter.scatter to all images. If you want to change a single lua file generated by Kwik, you may modify the file directly but it loses the change when you publish again. Instead modifying the file directly, you can inject a custom file with the same file name under ‘custom’ folder.

For instance, If you add Hello_World_image_.lua with a filter, you can copy the kwik-generated Hello_World_image_.lua to custom/components/page01 folder, then you can modify the Hello_World_image_.lua. Publish again and Kwik knows there is a custom file of Hello_World image lua and redirects to use the custom file internally.

Modification is made to custom/components/page01/Hello_World_image_.lua

the lua files under build4 uses custom/components/page01/Hello_World_image_.lua. Corona Simulator shows Hello World with scatter filter.

If you modify Hello World layer on photoshop, Kwik publishes it to the original components/page01/Hello_World_image_.lua with the modified result but won’t overwrite custom/components/page01/Hello_World_image_.lua. You may need to merge the changes from the original to the custom file with your text editor


tmplt contains the template files from which kwik uses to generate lua files. You can modify the files in tmplt folder to make custom codes of yours. When Kwik is updated, the template folder is updated with Project Properties > Update tmplt. The old tmplt folder is renamed when updating tmplt.

Update Tmplt


The latest tmplt is available from GitHub of Kwiksher. Every time a daily build of Kwik is released, the git repo is updated too. So if you prefer to use git, just clone the repo.