Skip to content

Create SXA Theme using Sitecore SXA CLI?

Sitecore Experience Accelerator (SXA) CLI is a tool that simplifies front-end development when working with SXA sites. It enables you to create and manage themes and scripts directly from your local development environment.

To create a new SXA theme using the Sitecore SXA CLI, follow the steps below. Please note that this requires Node.js and npm to be installed on your local machine.

1.Install the SXA CLI:  If you haven’t installed the SXA CLI yet, you can install it globally by running this command in your terminal:

//Codeshell

   npm install -g @sxa/CLI

//Code

2.Create a new SXA Theme:  Navigate to the folder where you want to create the theme and run this command in your terminal:

//Codeshell

   sxa new theme

//Code

3.Follow the prompts:  The CLI will ask you for some information about the theme:

  • Theme name:  This is the name of the theme.
  • Base theme:  The theme that this theme will be based on. Usually, this is the Basic2 theme, but it can be any other theme.
  • Assets source:  The location of the source of the theme. Usually, this is `/sitecore/media library/Themes`.
  • Server URL:  The URL of your Sitecore instance. This is used to sync the theme back to the server.
  • Username and Password:  The username and password for your Sitecore instance. These are also used for syncing.

Once you’ve provided all the information, the CLI will create the theme and set up a local development environment for it.

4.  Start the Theme:  You can start working on the theme immediately by running this command in your terminal:

//Codeshell

   npm start

//Code

This command will start the theme and set up a watcher to automatically sync any changes you make back to the server.

Remember, the Sitecore SXA CLI is a powerful tool that can simplify your front-end development process when working with SXA. Make sure to explore all its features to get the most out of it

Share this post on social!

Leave a Reply

Your email address will not be published. Required fields are marked *