BETA

Compiling a Custom Application

One of the necessary steps to prepare your Custom Application for a deployment is to create a production build. The production build contains a index.html.template file that needs to be compiled into a index.html file to serve the Custom Application.

This section describes what compiling the Custom Application means and what are the steps to do that.

Why compile?

When creating a production build, mc-scripts build takes your Custom Application code and generates assets that can be served statically.

One of these assets is a file named index.html.template. This file contains references to bundles (your code and other assets) and placeholders that needs to be replaced with values specific to your Custom Application configuration.

Therefore, by compiling a Custom Application the final index.html file is created with all the correct runtime values in place.

Once your Custom Application is compiled, it is ready for deployment.

Prerequisites

Before you get started, you need to do the following:

  • Configure your Custom Application.
  • Create a production build of your Custom Application.

Compiling your Custom Application

Run the following command to compile your Custom Application:

mc-scripts compile-html

The command above does what we need: it compiles a index.html using the references to the JavaScript bundle (created by running mc-scripts build). It also replaces the placeholders with the needed values based on the Custom Application configuration file. At this point the index.html file is ready for production usage.

Deployment

We provide some step-by-step tutorial examples for hosting a Custom Application statically to popular hosting providers:

Want to deploy to a specific cloud provider? Let us know, and we can provide you with an example.

Sign upLog inTech BlogIntegrationsStatusSupportUser Research Program
Copyright © 2021 commercetools
Privacy PolicyImprint