Expansive Commands

The Expansive utility expansive is your command line interface to Expansive. It is typically installed as /usr/local/bin/expansive on Linux and Mac and under Program Files/Embedthis Expansive on windows.

Expansive supports the following commands.

Initialization

Before using Expansive, you must initialize the directory that will contain your web site or web application. Expansive is configured by an expansive.json configuration file. This defines top level configuration for the site and controls how Expansive renders the site. An expansive.json file must be present for Expansive to run.

The expansive init command will create an expansive.json file as well as other required files and directories.

$ expansive init

This will create the following files and directories:

NameDescription
contentsSource content for the web site including web pages, images and assets.
distDistribution directory where the final public documents of the web site will be placed.
expansive.jsonExpansive configuration file.
layoutsDirectory for master page layouts.
package.jsonWeb site package description file.
partialsDirectory for partial pages.

Install Packages

Expansive relies on the Pak package manager to install, upgrade and manage extension packages. Expansive has a wide selection of packages that extend the product's core functionality. To install a package, use pak install. For example, to install the exp-js package to process and minify Javascript files.

$ pak install exp-js

Once one or more packages have been installed, the following directories will be created by Pak.

NameDescription
paksInstalled packages — full contents.
contents/libExported package library code and assets.

Render Site

After you have created some web pages under the contents directory, you can render the site. Rendering is the process of generating your site from content by combining layout pages, partial pages, running scripts and other processing before saving the site under the dist (distribution) directory.

$ expansive render

Once rendered, you can copy the dist directory to your web server for hosting.

Render a Files

$ expansive FILE

If you wish to render just a single file or set of files, you can specify the leading portion of the desired filename under contents. For example:

$ expansive contents/index.html

Watch for Changes

Expansive can monitor the file system for changes and automatically re-render any modified content. The expansive watch command will nap for a short period (1 second by default) and then check if any files have been modified. If a single page is modified, it will be rendered. If a layout or partial is modified, the entire site will be rendered. You can change the default nap period via the control.watch property in the expansive.json configuration file.

$ expansive watch

Serve Browser Requests

For development, or light web serving, you can use the built-in web server in the expansive utility. Running expansive serve or running the expansive command without any arguments will listen by default on localhost:4000 for browser requests. Browse to http://localhost:4000 in your browser. This command will also watch for changes to any web pages and will automatically re-render content as required.

$ expansive

Clean Distribution Directory

To clean the dist directory of rendered content, use expansive clean.

$ expansive clean

Edit Configuration

To edit configuration properties in the expansive.json file, use expansive edit key=value. Omit the =value to display the current property value.

$ expansive edit control.listen=127.0.0.1:5000

Get and Set Execution Mode

To get the current execution mode, use expansive mode. To set the mode, use expansive mode MODE. For example:

$ expansive mode release $ expansive mode debug

Options

The expansive command can accept the following command line arguments.

OptionDescription
--abortAbort rendering on errors
--benchmarkShow per-plugin statistics
--chdir directoryChange to directory before running
--listen IP:PORTListen endpoint to serve on
--log path:levelLog messages to log file at verbosity level (0-5)
--nocleanDo not clean the dist directory before rendering
--norenderDo not do an initial render before watching
--nowatchDo not watch for changes, just serve
--quietQuiet mode
--trace path:levelTrace http requests to file at level (0-5)
--verboseVerbose mode
--versionDisplay version information

© Embedthis Software. All rights reserved.