wq collectjson

wq version: 0.7.8 1.0 1.1
Docs > wq.app: Build Tool

wq collectjson


wq collectjson is a component of the wq build process that collects the contents of files a directory into a single JSON or JavaScript (JSONP/AMD) file. The keys in the output object will be the filenames (without suffix) and the values will contain the contents of each file. wq collectjson useful for embedding Mustache templates into the build, or for splitting a large JSON configuration object into separate files for development.

Most files will be inlined as strings, but JSON and YAML files can be embedded as nested objects. The output can be either JSON or a JSONP file. Using define as the JSONP callback will effectively create an AMD module.

The collectjson section in wq.yml can be a single configuration object or an array of configuration objects (to create multiple output files). The available options are:

name purpose
paths An array of folders to search (relative to current directory)
output The filename of the output file (relative to current directory)
type Type of files to search for (e.g. json, yaml)
extension File extension to search for, if different than type (e.g. yml)
indent Number of spaces to indent the JSON by (default is 4)
jsonp JSONP callback (use "define" to create an AMD module)

wq collectjson can also be configured entirely via command line options; for more information run wq collectjson --help.