I'm not familiar with Jade so I can't speak to that, however I would suspect that even if Jade did allow Twig syntax it would be mostly redundant.
Regarding variables. There are a number of ways to create variables in craft.
- Twig Variables - defined using
{% set variable = 'value' %}
, which can be printed using {{ variable }}
or otherwise referenced by name. You can also assign a block of code to a variable using {% set variable %}...{% endset %}
.
- Globals - global fields defined within the CP which can be accessed in your templates using
{{ globalSetHandle.fieldHandle }}
.
- Environment Variables can also be defined in your config file (although these are generally reserved for variables that are unique to a particular environment, i.e. 'BaseUrl' ).
- Plugin Template Variables - defined in php in your plugin's variables files
You might also want to look at Twigs extends
, include
, and embed
methods.
I'm not exactly sure what you mean by "custom function for each global variable". Twig has some methods and functions that allow you to manipulate data (see twig functions and craft functions), as well as macro
functionality for creating reusable code. Although if you are doing anything overly complicated it might be best to create a custom plugin.