---
title: "Add a theme using SXA CLI"
slug: "add-a-theme-using-sxa-cli"
abstract: "Automate theme creation for SXA sites."
---
# Add a theme using SXA CLI

SXA CLI is a useful command line tool to automatize tasks for an SXA project. This topic describes how to add a theme using SXA CLI. This can be convenient if you want to have more control over your assets and use a version control system, such as Git.

To add a theme using SXA CLI:

1. Go to `Website\App_Config\Include\z.Feature.Overrides` and enable the `z.SPE.Sync.Enabler.Gulp.config.disabled` file.
2. Open a command prompt terminal and install the registry:

    `npm config set @sitecore:registry=https://www.npmjs.com/package`

3. Use npm and the install command to install SXA CLI as a global package: `npm i -g @sitecore/sxa-cli`.
4. Run `sxa register <url>`.

    For the `<url>`, enter the instance for which you want to create the theme.

5. Run `sxa new <ThemeName>`.

    Optionally, you can enter the name of the new theme (`<ThemeName>`).

6. Enter the theme path: `<Rootfoldername/Childfoldername>`.
7. Enter answers to the questions prompted by npm. Questions include: login, password, theme name, theme path.

    If you answer *Yes* to the question *Do you want to set up theme config file?,* the config file is automatically updated.

8. Change the directory to the folder that contains the new theme: `cd <ThemeName>`
9. Run `npm i`.
10. Your new theme is now available. Make sure to assign your new theme to your site:

    Go to `Sitecore/Content/<tenant>/<site>/Settings`, and in the **Site Configuration** settings, in the **Compatible themes** field add your new theme to the **Selected** field. Now you can select the theme as your site's current theme.

The following table describes the most important commands for using SXA CLI in your theme setup:

| Command | Description |
| --- | --- |
| `sxa new <ThemeName>` | Runs the create theme pipeline and stores the theme both locally and in Sitecore. Use this command to create a new theme for your site. |
| `sxa init` | Sets up the theme variable by answering a list of questions. Use this command to change the theme setup. |
| `sxa register <instanceUrl>` | Globally registers an instance of Sitecore URL. |
| `sxa get-url` | Checks the currently registered URL. |

<details>
<summary><h2>Video: Create a theme using SXA CLI</h2></summary>

You can watch this video from the Discover Sitecore channel for a demonstration of how you can create a theme using SXA CLI:

</details>