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.
- expansive init
- expansive render
- expansive files...
- expansive watch
- expansive serve
- expansive edit
- expansive mode
- expansive clean
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:
Name | Description |
---|---|
contents | Source content for the web site including web pages, images and assets. |
dist | Distribution directory where the final public documents of the web site will be placed. |
expansive.json | Expansive configuration file. |
layouts | Directory for master page layouts. |
package.json | Web site package description file. |
partials | Directory 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.
Name | Description |
---|---|
paks | Installed packages — full contents. |
contents/lib | Exported 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.
Option | Description |
---|---|
--abort | Abort rendering on errors |
--benchmark | Show per-plugin statistics |
--chdir directory | Change to directory before running |
--listen IP:PORT | Listen endpoint to serve on |
--log path:level | Log messages to log file at verbosity level (0-5) |
--noclean | Do not clean the dist directory before rendering |
--norender | Do not do an initial render before watching |
--nowatch | Do not watch for changes, just serve |
--quiet | Quiet mode |
--trace path:level | Trace http requests to file at level (0-5) |
--verbose | Verbose mode |
--version | Display version information |