Automating tasks using SXA CLI

Version: 10.4

SXA CLI is a useful command line tool that helps you automate tasks for an SXA project. This topic describes the most common tasks. For a complete list of all tasks and possible additions, go to The SXA watch, build, and upload tasks.

Creating a new theme

If you have all the prerequisites in place, you can add a new theme for your SXA project using the following task:

RequestResponse
sxa new <Theme name>

This task runs the create theme pipeline and after you answer a list of questions it stores the theme both locally and in Sitecore.

All assets are stored locally. You can use GitHub or any other version control system to work together on styles and scripts.

In Sitecore, there is a placeholder for the theme. By default, this folder does not contain any assets:

Configuring theme settings

You can reconfigure theme settings at any time. For example, if you first chose not to upload CSS source files but later want to change this, you can (re)configure theme settings using the following task:

RequestResponse
sxa config

Seeing the changes

If you finish developing and want to upload the changes, you can upload modified files automatically using the following task:

RequestResponse
sxa watch All

For example, if you changed the sass styling of the accordion:

Building preoptimized min

If you want to build all Sass tasks and the minification. The following task updates all files locally but does not upload to the server.

RequestResponse
sxa build

Updating assets

You can update and upload assets to your theme at any time, for example, if you work in a team and you want to update your local theme with the latest changes made by your colleagues. You can update your theme using the following task:

RequestResponse
sxa rebuild All

This tasks uploads all scripts, images, and styles to the theme in Sitecore.

Uploading assets

You can upload assets to your theme at any time. For example, if you made some changes in CSS and you want to upload these files only.

RequestResponse
sxa upload Css

Do you have some feedback for us?

If you have suggestions for improving this article,