TITS is Templating System
TITS is a service for running various Javascript templates through the use of adapters. It supports multiple namespaces (template collections).
TITS is a server built on NodeJS that runs on Linux and OS X. The server process listens on port 60065 by default. Clients (eg. PHP) connect to the TITS process through the driver and perform a sequence of fetch operations.
Installing
npm install -g tits
Getting Started
First you should know about TITS configuration file. You have to provide such file when you start TITS process.
Configuration file
See examples/fest/tits.json. TITS takes the following parameters:
{
"path" : "./data",
"watcher": true,
"workers": 1,
"adapters": [{
"extension": "xml",
"name": "fest",
"main": "../../adapters/fest.js",
"options": {
"debug": true,
"nothrow": false,
"beautify": true
}
}],
"namespaces": [{
"name": "example",
"path": "./templates",
"context": "./context.js"
"public": {
"path": "./www",
"format": "amd",
"files": [
"*"
]
}
}]
}
You want to validate your configuration file.
Run tits without options. It will print out the configuration.
tits examples/fest/tits.json
You are in development environment and want to start the service with enabled file watcher.
You have to set watcher parameter in the configuration file. And start tits with the following arguments.
tits --compile --server examples/fest/tits.json
It will build namespaces (option --compile) and start the server process. On file changes the server will rebuild namespaces and restart workers.
Production.
You have to build namespaces (compile template collections) first.
tits --compile examples/fest/tits.json
You have to disable the file watcher in configuration file and start tits:
tits --server examples/fest/tits.json
Note it's not necessarily to have the template sources in production.