Rendering the Site

Rendering is the processing of input content together with layout pages into final web pages and assets, ready for serving. To render the site, use the expansive render command.

$ expansive render [Created] index.html

This process all the files under contents and creates a complete, rendered web site under the dist directory.

You can also render and then serve the content while dynamically watching for any changes to the input sources by invoking expansive without any other arguments.

$ expansive serve [Listen] 127.0.0.1:4000 [Render] Initial render ... [Created] index.html [Watching] for changes every 1 sec ...

Expansive will first render the site and will then listen on port 4000 for browser requests.

Rendering Pipeline

Expansive rendering consists of two phases

Expansive uses a multi-stage processing pipeline to transform content pages into a final page suitable for viewing. During this process, each page, layout and partial page progresses through the following pipeline:

Transformation by File Type

For each page, Expansive will interpret document filename extensions and automatically transform content from one format to another. For example, the filename index.html.md implies that the data is in Markdown format via the .md extension, and it should be converted to html. Expansive will examine each nested extension and process the document until it reaches an extension for which there are no further transformations defined.

For example, Expansive will process the file index.html.md.exp as follows:

index.html.md.exp → index.html.md → index.html

Expansive uses the .exp extension to specify the document has embedded Javascript. Expansive will process this by first running the embedded Javascript, then piping the result through the Markdown filter and finally saving the result as index.html after applying the appropriate layout.

Nearly all transformations occur in-memory without persisting intermediate formats to disk. This means the pipeline is very fast for most transformations.

The transformation pipeline for specific extensions can be overridden via the 'expansive.transforms' meta property.

© Embedthis Software. All rights reserved.