Come build with us.
Stacks API v6 for Stacks 2.5
All of the template files that your stack uses must be declared in the Info.plist inside the templates array. Each item in the array is a dictionary that defines the name, type, and scope of the template.
The file name of template. This should be only the name, not the complete path.
The type of template. This must be one of: html
, css
, js
, php
, or file
.
each
or page
each
The scope of the template defines how the template will be added to the page.
Page scoped HTML templates will be place in the <head> tag of the page following the CSS and JS links. This is useful for including links to external CSS and libraries.
Just as in each scoped templates, CSS is included in Edit Mode but Javascript will be disabled.
Use the feature sparingly as linking to external resources can slow down page loads
Note: For improved performance disable external CSS links in Edit Mode.
Page scope CSS templates will be added to the pages CSS file and will preceed the each scoped CSS. This allows you to define the base styes once for all stack instances in the page scope and override the styles when necessary in the each scoped templates.
Page scoped Javascript is included in its own closure separate from the closure for the each scoped Javascript. This allows you to define Javascript functions once for all instances of the stack on the page which will speed up the page and reduce the memory footprint.
Page scoped PHP will be included in the linked php. It will preceed the each scoped PHP.
Most files that are exported with the page should be added as an asset. Assets are included without any sort of template processing so there is no performance penalty for adding them.
There are times when it is helpful to inject properties from your stack into included files. You can add a template with the type of file
for this purpse. File templates can be any text file (UTF-8).
Because template files may be very slow to process, they will not be processed for edit mode. Only HTML and CSS templates are processed for edit mode.