Overview
Shoplazza CLI is a command-line interface tool that helps you build Shoplazza themes and apps. It quickly generates Shoplazza themes and apps. You can also use it to automate many common development tasks.
This document explains how to use Shoplazza CLI for theme development.
Features
Shoplazza CLI accelerates your theme development process with the following features:
- Safely preview, test, and share changes to themes using development themes
- Hot reload CSS and section changes, or automatically refresh a page on file change, when previewing a theme
- Initialize a new theme using Nova 2023 as a starting point
- Push and publish themes from the command line
Development themes
Development themes are temporary, hidden themes that are connected to the Shoplazza store that you're using for development. When you connect your theme to a store as a development theme, you can use that store's data for local testing.
You can create a development theme using the Shoplazza theme serve command.
Your development theme is deleted when you run shoplazza logout
. If you want a preview link for the theme that can be accessed after you log out, then you should push your development theme to an unpublished theme on your store.
Your development theme can be used to perform the following tasks:
- View changes in real-time to a theme that you're developing locally
- Customize and interact with the theme using the Shoplazza admin theme editor
- Share a password-protected preview of the theme with other developers
Installation
To learn how to install Shoplazza CLI on Windows, macOS, or Linux, refer to Install Shoplazza CLI.
Getting started
Refer to the following tutorials for details about creating or working on a Shoplazza theme using Shoplazza CLI:
Command reference
Refer to the Shoplazza CLI theme command reference to explore the commands available to build themes with Shoplazza CLI.
Authenticating and accessing stores
As a theme developer, you might want to use a Shoplazza store to test your theme, or to share your theme with stakeholders. You also might need to work on multiple stores or use a different set of credentials to authenticate with a particular store. Learn about the authentication methods that you can use to work on stores using Shoplazza CLI, and how to switch between accounts and stores.
Authentication
You can only use Log in with a Shoplazza account authentication methods to work on a theme in a Shoplazza store using Shoplazza CLI.
Log in with a Shoplazza account
You can use the following types of Shoplazza accounts to access the store you want to work on:
- A staff account with the Themes permission
- The store owner's account
To authenticate with a Shoplazza account, run a command that requires store access. You'll be prompted to log in.
Switching between accounts
If you need to switch between accounts, then log out of the current account using the following command:
shoplazza logout
The next time you enter a command that requires authentication, you'll be prompted to log in, and can enter a new set of credentials.
Connecting to a store
Firstly, to authenticate with a Shoplazza account, run a command that requires store access, then enter a command that requires you to interact with a Shoplazza store.
shoplazza login --store my-store
shoplazza theme serve
The store that you specify is used for future commands until a new store is specified.
If you want to change the store that you're interacting with, you must first log out of the current account you're currently logged in, and then log in to a new Shoplazza store you want to interact with.
Directory structure
You can run certain theme commands, such as shoplazza theme serve
, only if the directory you're using matches the default Shoplazza theme directory structure. If you use build tools to generate theme files, then you might need to run commands from the directory where the generated files are stored.
The default Shoplazza theme directory structure is as follows:
└── project
├── assets
├── config
├── layout
├── locales
├── sections
├── snippets
└── templates
└── customers
Upgrade Shoplazza CLI
To upgrade Shoplazza CLI the latest version, use the upgrade command:
npm update -g shoplazza-cli
To check your CLI version, use the version command:
shoplazza version
Updated over 1 year ago