Configuration

Format

The configuration file is in yaml format.

Multiple configurations can be specified in one file. For example:

id: config1
---
id: config2
inherits: config1
---
id: config3
inherits: config1

Configuration options

alias-all-strings

Aliases all string literals to global instances, to avoid creating more objects than necessary.

checks

A map of Compiler check-levels. Values can be one of WARNING, ERROR or OFF.

For example:

checks:
    accessControls: ERROR
    visibility: ERROR
Available checks:
accessControls visibility checkRegExp checkTypes checkVars deprecated fileoverviewTags invalidCasts missingProperties nonStandardJsDocs undefinedVars aggressiveVarCheck brokenClosureRequiresLevel checkGlobalNamesLevel checkGlobalThisLevel checkMissingGetCssNameLevel checkMissingReturn checkProvides checkRequires checkUnreachableCode reportMissingOverride

closure-library

True to enable closure library inclusion.

debug

Equivalent to the command-line –debug flag for the Closure Compiler. Defaults to false.

default-externs

Whether the default externs should be used by the compiler.

define

An object literal that contains a mapping of variables in the JavaScript code that are annotated with @define (indicating that they can be redefined at compile time) to the values that should be substituted. The following should be specified to set goog.DEBUG to false at compile time:

define:
  goog.DEBUG: false

Note that these compile-time defines will only take effect when the code is compiled in either SIMPLE or ADVANCED modes.

id

Every config must have an id.

The id must be unique among the configs being served by clover because the id is a parameter to every function in the clover REST API.

externs

Files that contain externs that should be included in the compilation.

By default, these will be used in addition to the default externs bundled with the Closure Compiler.

There are also externs for third party libraries, such as jQuery and Google Maps, that are bundled with the Closure Compiler but are not enabled by default.

These additional extern files can be seen in the Closure Compiler’s contrib/externs directory. Such externs can be included with a // prefix as follows:

externs:
- //jquery-1.5.js
- //google_maps_api_v3.js
- //chrome_extensions.js

inputs

Input files to be compiled.

Each input file and its transitive dependencies will be included in the compiled output.

mode

Compilation level, which must be one of “DEPS”, “RAW”, “WHITESPACE”, “SIMPLE”, or “ADVANCED”.

The default value is “DEPS”.

DEPS mode simply includes a base.js (and the generated deps.js).

RAW mode includes all inputs (and transitive requirements) for the compilation.

WHITESPACE mode generates a concatenated whitespace.

SIMPLE and ADVANCED is equivalent to Closure compilers SIMPLE optimizations, respectively.

warnings

Sets how warnings are treated.

When set to true, warnings will be reported as errors.

output

If specified, when the build command is used, clover will write the compiled output to this file rather than standard out.

output-sourcemap

If specified, when the build command is used, clover will write the compiled output to this file rather than standard out.

paths

Files or directories where the transitive dependencies of the inputs can be found.

pretty-print

Equivalent to the command-line –formatting=PRETTY_PRINT flag for the Closure Compiler. Defaults to false.

strip-name-suffixes

Name suffixes that determine which variables and properties to strip.

This can be useful for removing loggers:

strip-name-suffixes:
- logger_

strip-name-prefixes

Name prefixes that determine which variables and properties to strip.

strip-type-prefixes

Qualified type name prefixes that determine which types to strip.

test-excludes

By default, all files that end in _test.js under the paths directories are included in the test runner that runs all of the JS unit tests. This option can be used to specify subpaths of paths that should be excluded from testing.

For example, if the closure-library option is used to specify a custom Closure Library, then it is likely that third_party/closure will be specified as a path to include utilities such as goog .async.Deferred. Including such a directory will also include closure/goog/dojo/dom/query_test.js, which fails when run by clover because its corresponding query_test.html file includes a hardcoded path to

base.js that cannot be loaded by clover. If this is a problem, then third_party/closure should be included as an argument to test-excludes.

See the section on testing for more details.

translations

An xtb translations file.