Configuration

Tonic allows you to build your applications in any way you can dream up. Thanks to the powerful and flexible configuration options that makes this possible. These options can either be specified in a config.json file placed in your distribution root directory, or can be specified as commands for the grunt executable in the terminal.

Configuration Settings

Global Configuration

The table below lists the available settings for Tonic, and the various commands (specified on the command-line) and options (specified in the configuration file) that control them.

Setting Options

Static Root

Change the directory where Tonic will serve files

"staticRoot"

Data Root

Change the directory where Tonic will look for data files

"dataRoot"

Application Title

Application name used in HTML.

"title"

Defaults

see below

Destination folders are cleaned on builds

The contents of dist/ are automatically cleaned when Tonic is built. Files or folders that are not created by Tonic will be removed. Do not use dist/ as an important location; instead, use it as a staging area and copy files from there to another directory or web server.

Build Command Options

Setting Commands

Initialize

Copy third party javascript libraries and fonts to the distribution, and uglify or minimize the combined third party files into tonic.ext.min.js.

init

Default

Compile stylus files into tonic.app.min.css and tonic.min.css, jade files into tonic.app.templates.js and tonic.templates.js, and then uglify or minimize the combined templates and source javascript files into tonic.app.min.js and tonic.min.js.

Regeneration

Enable auto-regeneration of Tonic when files are modified.

watch

Testing

Perform code style, unit and end-to-end testing.

test

Documentation

Generate both HTML and MarkDown documentation.

doc

Simple Web Server

Serve and watch the configured Tonic root directory.

serve

Serve Command Options

The serve options are listed below.

Setting Flags

Local Server Port

Listen on the given port.

--port PORT

Do not use tabs in configuration files

This will either lead to parsing errors, or Tonic will revert to the default settings. Use spaces instead.

Default Configuration

Tonic runs with the following configuration options by default. Unless alternative settings for these options are explicitly specified in the configuration file, Tonic will run using these options.

Unused option

Please note that title may or may not be used in your Tonic application due to the fact that you may not use this element to configure your application.

{
# Where things are
  "staticRoot": "",
  "dataRoot": "/data",

# Application Name
  "title": "Tonic"
}