Skip to content

Templates

andreyover edited this page May 2, 2023 · 2 revisions

SDP Templates system

The SDP has a system of templates to make it easier for you to combine styles and write code.

Templates can only be one type - handwritten. Handwritten templates differ from technical ones in that they have no access to the class and styles and therefore cannot interact with it, such as --width.

Handwritten templates

To make your own templates, you need to become familiar with "immutable variables", what we call single classes (meaning they can only be in code once) that can hold information that can be used elsewhere. They are "immutable" because their names or syntax cannot be changed from the user's point of view, and because they usually serve only a specific purpose.

Now, how do I create my own template? Simple!

For templates to work and for SDP to see them, you need to create an "immutable variable" _templates right in the code, preferably at the very top.

Then, you should create the first template:

_templates(my_template[m: 0; color: white;]);

Here we created a template "my_template" and set parameters that when it is used it will show margin with a value of 0 and color with a value of white.

We can write almost anything in there and create as many templates as we want

Clone this wiki locally