File templates are available via the
File / New From Template menu and are a way to create files with content that serves as a base for a new file of a certain type or for a certain purpose. This article describes how to create a custom theme and add it to a Cloud9 Bundle.
A template file is a collection of multiple templates. The basic format is similar to the one used for snippets.
Templates start with a list of variable definitions and then a list of lines that contain the code of the template itself.
# Comment <field> <value> <field> <value> <tab>templatecontents <tab>templatecontents template ended
A file can contain any number of these underneath each other.
There are three required fields that must be present for each template.
filenameThe filename for the file. Specify only the extension.
captionThe caption of the menu item for this template.
sectionThe grouping of the template. This may have / as a separator of levels.
The example below contains two snippets. One for an xml and for an html document.
filename .html section General caption HTML file <!DOCTYPE html> <html> <head> <title> </title> </head> <body> </body> </html> filename .xml section General caption XML file <?xml version="1.0" encoding="UTF-8"?> <root />
A bundle can contain one or more template files. Each template file must be placed in the
templates directory and have the extension
Suppose your template file is called
node.templates. Your file structure will look something like this:
└─ your.plugin ├─ templates | └─ node.templates ├─ package.json └─ README.md
Updated less than a minute ago