Extending xStatic v2+

You can extend xStatic even more with the version 2 upgrade and this is the place to find out how.

Build Process

The build process is the first of the two main xStatic processes. This is in control of iterating through the site, generating the static versions, and storing them locally ready for deployment.

You can customise most of the process by choosing from existing components or implementing your own.

Deploy process

The deploy process is the second main process in xStatic. This stage takes the built output and pushes it to a location configured by the user. In the CMS dashboard you fill in these details in the Deployment Target field. The options available in this field are determined by the `IDeployer` implementations present in the code base.

Actions

An action is an async operation that can be run as part of the build process. Currently this is limited to PostGenerationActions that run after the build process is complete.

This can be used to rename / move / delete files which can be very useful for sitemaps, redirects, or files required for certain hosting providers.
For example, the Netlify xStatic package has a post action that creates the 404 page.

Deployers

A deployer in xStatic is a component that takes a folder of static files and pushes it to a remote location. Creating your own deployer is fairly straightforward, but check NuGet first for any open source xStatic extensions.

Deployer implementations are split into 2 mandatory classes and 2 optional (but recommended) classes.

File Name Generation

There are two types of namers in xStatic, file name generators and image crop name generators.

Image crop name generators are used by the `CroppedImageUrlTransformer` and the base generator class to determine how image files should be stored.

File name generators are used to determine the file names of the static files generated by xStatic. There are built in file name generators, but if you want to alter this it is easy to do so. You can then choose the namer when defining your export types in the CMS dashboard.

Generators

A generator defines how a umbraco nodes are turned into static files. Generally speaking, to create static HTML websites you will not need to create a custom implementation of this, you can customise your output with custom namers and transformers; if you need to create a different file type however, you can create your own custom generators.

Site Storers

Site storers are the component that stores the generated files ready for use by the deployer process in xStatic.

Transformers

Transformers are xStatic components that take the static content for a content item, perform an operation, and return an altered string. These can be used to change hostnames, alter image URLs, or any other string manipulation you may need to do. Custom transformers are easy to create. Transformers need to be curated into `TransfomerList`s before they can be assigned to an export type; this simply defines which transformers need to run and in which order.