Configuring Expansive

Expansive is configured by an expansive.json file that defines the top level configuration for the site and controls how Expansive renders the site. It specifies initial meta data, directory names, file patterns to process, ports to serve and processing instructions. Expansive uses sensible defaults so you typically do not need to configure much. An expansive.json file must be present for Expansive to operate.

Here is a typical expansive.json file:

{ meta: { site: 'https://www.embedthis.com/', }, control: { copy: [ 'images' ], listen: '127.0.0.1:4000' }, "release": { "services": { "css": { "minify": true }, "js": { "usemap": false } } } }

The meta property section defines the default public URL for the site and also provides data properties that may be used in content pages. The copy property provides a hint to Expansive that anything under the 'images' directory should be copied and not processed by the Expansive pipeline. The services property set provides configuration for the plugin services to control their operation and enable/disable minification.

Creating expansive.json

To create an expansive.json file, use expansive init.

$ expansive init

Alternatively, install a ready-made Expansive skeleton package that includes an expansive.json file such as exp-html-skeleton.

$ pak install exp-html-skeleton

Control Properties

These are the standard properties in the control collection in expansive.json.

Name Description
copy Array of patterns to copy without processing. The patterns may include * or **. If a directory is specified, all files under the directories copied. The files are relative to the contents directory.
documents Array of patterns to process. The patterns may include * or **. If a directory is specified, all files under the directories are copied. The files are relative to the top-level directory.
files Array of directories containing raw content to copy to dist without processing. By default, contains files.
listen Address on which to listen for HTTP requests. May be just a port number.
script Script to evaluate to inject code into the Javascript global execution context. This is visible to scripting in all pages.
pipeline Hash of extension mappings to a list of transform services for those mappings. Mappings are in the form ext -> ext. For example: transforms: { 'less -> css': [ 'less', 'css-prefix', 'css-minify', 'gzip' ] 'pre': [ 'blog', 'analytics', gzip' ] }

The special names pre and post may be used to specify the transform order for invoking pre and post processor transform callbacks.

Some of the standard transform names are: esp, less, markdown, sass, gzip, css-minify, js-minify, css-prefix, and shell.

watch Time in milliseconds to wait between checking for rendering.

Sample expansive.json

Here is a sample expansive.json configuration file for an Angular application.

{ meta: { site: 'https://www.embedthis.com/appweb/demo/', sitemap: { files: [ '**.html', '!missing.html', '!unsupported.html' ] } }, services: { 'clean-css': true }, debug: { services: { compress: false, 'js': { usemap: false, }, 'angular': { 'html': false, 'package': false } } }, release: { services: { compress: false, 'css': { minify: true }, 'js': { usemap: false }, 'angular': { 'html': true, 'js': true, 'package': true, 'scripts': [ 'contents/**.js', 'lib/esp*/**.js', 'lib/angular*/**.js' ] } } } }

© Embedthis Software. All rights reserved.