Theme commands
This article outlines the theme commands available in the SHOPLINE CLI. The syntax for these commands is sl theme [command].
To access help for any specific command from the command line, use sl [command] -h.
init
Initializes a project by pulling theme files from GitHub to your local computer.sl theme init <THEME_NAME>
Parameter details
| Parameter | Required or not | Description |
|---|---|---|
| THEME_NAME | Yes | The name you want to assign to the theme. The cloned files are stored in a folder with this name. The theme name format can be one of the following: + demo-theme: Creates a new folder in the current directory to store new theme files, using the theme name as the folder name.+ Relative path format ../shopline/demo-theme: Creates a new folder to store new theme files based on the input path and current working path, with the theme name as the path's basename. |
| --path <PATH> | No | Your theme directory path. |
list
Lists all themes for the currently logged-in store. Each theme includes information such as the theme ID, name, and status.sl theme list
serve
Uploads the current local theme as a development theme to your connected store for real-time preview and development.sl theme serve
This command also returns the following information:
- Local preview link:
http://127.0.0.1:8282- This link is for your development theme. It automatically hot-reloads changes or refreshes the entire page when local files change, ensuring you see store updates in real time.
- Online preview URL: An online URL to check and share the current theme effect in real time.
- Theme editor URL: A URL to the theme editor in the SHOPLINE Admin.
If you already have a development theme in the current environment, this command will replace the development theme with your local theme.
Tip: You cannot use http://127.0.0.1:8282 to preview the checkout page.
Caution:
- The development theme will be deleted when you run the
sl logoutcommand. - You can only run this command in a directory that matches the default SHOPLINE theme directory structure.
Optional parameters
| Parameter | Short | Description |
|---|---|---|
| --port <PORT> | Specify the local port for the theme preview. Default value: 8282 | |
| --live-reload <MODE> | The level of content reloading when making changes to the theme. Valid values are: + full-page(default): Refreshes the entire page when a file is modified. + off: Disables live refreshing, so changes to any file will not refresh the entire page. | |
| --theme-editor-sync | Enable bidirectional synchronization for theme JSON files. When this option is activated, changes made in the theme template editor within the SHOPLINE Admin will be applied to the local copy of the template. | |
| --only | -o | Pull specified files only. It can be used multiple times within a single command. Specify multiple files using the following formats: + Simple file name: templates/collection.temp.json + Wildcards: config/*_secret.json, *.jpg |
| --ignore | -x | Skip specified files during file pull. It can be used multiple times within a single command. Specify multiple files using the following formats: + Simple file name: templates/collection.temp.json + Wildcards: config/*_secret.json, *.jpg |
| --path <PATH> | Your theme directory path. | |
| --environment <ENV_NAME> | -e <ENV_NAME> | The environment configuration you want to use. |
pull
Fetches theme files from the store.If no theme is specified, you will be prompted to choose a theme from the list in the store.
If the current directory is not empty, the CLI will provide you with two options:
- Overwrite files with the same name (default).
- Clear the current directory before pulling the theme files.
sl theme pull
Optional Parameters
| Parameter | Short | Description |
|---|---|---|
| --theme | Store theme ID (can be obtained using the listcommand). | |
| --live | -l | Pull a published theme. |
| --development | -d | Download the remote development theme code to the local. |
| --only | -o | Pull specified files only. It can be used multiple times within a single command. Specify multiple files using the following formats: + Simple file name: templates/collection.temp.json + Wildcards: config/*_secret.json, *.jpg |
| --ignore | -x | Skip specified files during file pull. It can be used multiple times within a single command. Specify multiple files using the following formats: + Simple file name: templates/collection.temp.json + Wildcards: config/*_secret.json, *.jpg |
| --nodelete | -n | Run the pull command without deleting local files. |
| --path <PATH> | Your theme directory path. | |
| --environment <ENV_NAME> | -e | The environment configuration you want to use. |
push
Uploads your local theme files to the store. If a theme is specified, it overwrites the remote theme. If no theme is specified, you will be prompted to choose a theme from the list in the store to overwrite.sl theme push
This command returns:
- A preview link you can share with others.
- A link to the theme editor in the SHOPLINE Admin.
Optional parameters
| Parameter | Short | Description |
|---|---|---|
| --theme | Store theme ID (can be obtained using the listcommand). | |
| --live | -l | Push to the live (published) theme. This option does not require --theme or --allow-live. |
| --development | -d | Push to the development theme. Creates a development theme if you do not have one. |
| --only | -o | Pull specified files only. It can be used multiple times within a single command. Specify multiple files using the following formats: + Simple file name: templates/collection.temp.json + Wildcards: config/*_secret.json, *.jpg |
| --ignore | -x | Skip specified files during file pull. It can be used multiple times within a single command. Specify multiple files using the following formats: + Simple file name: templates/collection.temp.json + Wildcards: config/*_secret.json, *.jpg |
| --nodelete | -n | Push local files to SHOPLINE, without removing remote files. |
| --allow-live | -a | Allow SHOPLINE CLI to overwrite the published theme. |
| --unpublished | -u | Upload the theme to the theme library as a new unpublished theme. You will be prompted to provide a theme name. Use the --theme parameter to include the name as part of the command. |
| --path <PATH> | Your theme directory path. | |
| --environment <ENV_NAME> | -e <ENV_NAME> | The environment configuration you want to use. |
package
Packages your local theme files into a ZIP file that can be uploaded to the SHOPLINE store.Cautions:
- The ZIP file should only include folders that match the SHOPLINE standard theme directory structure.
- The ZIP file must be named according to the following format:
theme_name-theme_version.zip, generated according to the theme name parameter defined in thetheme.schema.jsonfile.
sl theme package
Optional parameters
| Parameter | Description |
|---|---|
| --path <PATH> | Your theme directory path. |
Was this article helpful to you?