{"__v":17,"_id":"552836448962f339009a67ab","category":{"__v":9,"_id":"551df586e52a0b23000c62b6","pages":["551df5bfa77fec1700f6f296","551df5c9fa7f722d00db21f0","551df5dfa77fec1700f6f298","551df5eca7e98017009e3ede","551df5f4a77fec1700f6f29a","551df5fdfa7f722d00db21f3","551df609a7e98017009e3ee0","551f3c0450a0fc210057968e","552836448962f339009a67ab"],"project":"54d53c7b23010a0d001aca0c","version":"54d5635532d98b0d00384afb","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-03T02:05:58.352Z","from_sync":false,"order":3,"slug":"cloud9-bundle","title":"Cloud9 Bundle"},"parentDoc":null,"project":"54d53c7b23010a0d001aca0c","user":"54cfa8e1a8a4fd0d00b7fd1d","version":{"__v":10,"_id":"54d5635532d98b0d00384afb","forked_from":"54d53c7c23010a0d001aca0f","project":"54d53c7b23010a0d001aca0c","createdAt":"2015-02-07T00:59:01.934Z","releaseDate":"2015-02-07T00:59:01.934Z","categories":["54d5635632d98b0d00384afc","54d5635632d98b0d00384afd","54d5635632d98b0d00384afe","54d5635632d98b0d00384aff","54d5635632d98b0d00384b00","54d5635632d98b0d00384b01","54d5635632d98b0d00384b02","54d652097e05890d006f153e","54dd1315ca1e5219007e9daa","54e21e2b22de1c230094b147","54e68e62a43fe13500db3879","54fa1d3fe7a0ba2f00306309","551c453a23a1ee190034d19a","551df586e52a0b23000c62b6","551f39be6886f8230055f02a","55a6720751457325000e4d97"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.1.0","version":"0.1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-10T20:44:52.232Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":8,"body":"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](doc:cloud9-bundle).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/LdX07TX0S1OzPYbvzVAr_Screen%20Shot%202015-04-14%20at%2011.08.34%20AM.png\",\n        \"Screen Shot 2015-04-14 at 11.08.34 AM.png\",\n        \"1470\",\n        \"556\",\n        \"#599ed1\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n# Creating a Template File\n\nA template file is a collection of multiple templates. The basic format is similar to the one used for [snippets](doc:snippets).\n\nTemplates start with a list of variable definitions and then a list of lines that contain the code of the template itself.\n\n```\n# Comment\n<field> <value>\n<field> <value>\n<tab>templatecontents\n<tab>templatecontents\ntemplate ended\n```\n\nA file can contain any number of these underneath each other.\n\n# Creating a Template\n\nThere are three required fields that *must* be present for each template.\n\n- `filename` The filename for the file. Specify only the extension. \n- `caption` The caption of the menu item for this template.\n- `section` The grouping of the template. This may have / as a separator of levels.\n\n## Example\n\nThe example below contains two snippets. One for an xml and for an html document.\n\n```\nfilename .html\nsection General\ncaption HTML file\n\t<!DOCTYPE html>\n\t<html>\n\t    <head>\n\t        <title> </title>\n\t    </head>\n\t    <body>\n\t\n\t    </body>\n\t</html>\nfilename .xml\nsection General\ncaption XML file\n\t<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\t<root />\n```\n\n# Adding Templates to a Bundle\n\nA bundle can contain one or more template files. Each template file *must* be placed in the `templates` directory and have the extension `.templates`. \n\nSuppose your template file is called `node.templates`. Your file structure will look something like this:\n\n```\n└─ your.plugin\n    ├─ templates\n    |    └─ node.templates\n    ├─ package.json\n    └─ README.md\n```","excerpt":"","slug":"templates","type":"basic","title":"Templates"}
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](doc:cloud9-bundle). [block:image] { "images": [ { "image": [ "https://files.readme.io/LdX07TX0S1OzPYbvzVAr_Screen%20Shot%202015-04-14%20at%2011.08.34%20AM.png", "Screen Shot 2015-04-14 at 11.08.34 AM.png", "1470", "556", "#599ed1", "" ] } ] } [/block] # Creating a Template File A template file is a collection of multiple templates. The basic format is similar to the one used for [snippets](doc: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. # Creating a Template There are three required fields that *must* be present for each template. - `filename` The filename for the file. Specify only the extension. - `caption` The caption of the menu item for this template. - `section` The grouping of the template. This may have / as a separator of levels. ## Example 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 /> ``` # Adding Templates to a Bundle A bundle can contain one or more template files. Each template file *must* be placed in the `templates` directory and have the extension `.templates`. 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 ```