Theme commands
This reference lists the theme commands that you can use with Shopline CLI. The commands in this group use the syntax:shopline theme [command]
.
To access help for any of these commands from the command line, use shopline [command] -h
.
init
Clones a Git repository to your local machine to use as the starting point for building a theme.
shopline theme init <THEME_NAME>
Optional parameters
Parameter | Description |
---|---|
THEME_NAME | The name that you want to give your theme. Cloned files are stored in a folder with this name. <THEME_NAME> can be the following value:- demo-theme The new folder storage new theme file will be created in the current folder, and the theme name is the folder name. - It can also be a relative path like ../shopline/demo-theme According to the input path and the current working path, the new folder storage new theme file, the theme name of the pathname. |
--path <PATH> | The path to your theme directory. |
serve
Upload the current theme as the specified or development theme, to the store that you're connected to.
This command also returns the following information:
- A link to your development theme at http://127.0.0.1:8282. This URL can refresh the entire page when a file changes, allowing you to preview changes in real time using the store's data.
You can specify a port using--port
. - A link to the editor for the theme in the SHOPLINE admin.
- A preview link that you can share with other developers.
If you already have a development theme for your current environment, then this command replaces the development theme with your local theme. You can override this using the --theme-editor-sync
flag.
Development themes are deleted when you run shopline logout
.
You can only run this command in a directory that matches the default SHOPLINE theme directory structure.
shopline theme serve
Optional parameters
Parameter | Short version | Description |
---|---|---|
--port <PORT> | The local port to serve the theme preview from. | |
--live-reload <MODE> | The level at which content is reloaded when changes are made to the theme. Accepts the following values: - full-page - refreshes the entire page when a file is modified.- off - Deactivate live reload. | |
--theme-editor-sync | Enables two-way sync for JSON theme files. When this option is enabled, changes made to the theme editor in SHOPLINE admin are applied to the local copy of the theme. If the serve command is run with this flag, the differences between the local development theme and the online development theme will be listed, and the system provides two options: - local version override remote version (default) - remote version override local version | |
--only | -o | Uploads only the specified files to SHOPLINE. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats: - Simple file names: templates/collection.temp.json - Wildcards: config/*_secret.json , *.jpg |
--ignore | -x | Skips uploading the specified files to SHOPLINE. Specify multiple patterns to ignore by using the flag multiple times in a single command. Accepts references to files in the following formats: - Simple file names: templates/collection.temp.json - Wildcards: config/*_secret.json , *.jpg |
--path <PATH> | The path to your theme directory. | |
--environment <ENV_NAME> | -e <ENV_NAME> | The environment that you want to use. |
pull
Retrieves theme files from SHOPLINE.
If no theme is specified, then you're prompted to select from the available list of themes in your store.
If the current directory is not empty, CLI will provide two options for developers to choose:
- Override the same name files (default)
- After clearing the current directory, pull the theme file
shopline theme pull --theme <THEME_ID>
Optional parameters
Parameter | Short version | Description |
---|---|---|
--theme <THEME_ID> | Store theme id (it can be found with the list command) | |
--live | -l | Pulls the live (published) theme. |
--development | -d | Downloads theme files from your remote development theme. You can use this command to copy changes made to the development theme in the theme editor to your local copy of the theme. |
--only | -o | Downloads only the specified files from SHOPLINE. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats: - Simple file names: templates/collection.temp.json - Wildcards: config/*_secret.json , *.jpg |
--ignore | -x | Skips downloading the specified files from SHOPLINE. Specify multiple patterns to ignore by using the flag multiple times in a single command. Accepts references to files in the following formats: - Simple file names: templates/collection.temp.json - Wildcards: config/*_secret.json, *.jpg |
--nodelete | -n | Runs the pull command without deleting local files. |
--path <PATH> | The path to your theme directory. | |
--environment <ENV_NAME> | -e <ENV_NAME> | The environment that you want to use. |
push
Uploads your local theme files to SHOPLINE, overwriting the remote theme if specified. If no theme is specified, then you're prompted to select the theme to overwrite from the list of the themes in your store.
You can only run this command in a directory that matches the default SHOPLINE theme folder structure.
This command returns the following information:
- A link to the editor for the theme in the SHOPLINE admin.
- A preview link that you can share with others.
shopline theme push --theme <THEME_ID>
Optional parameters
Parameter | Short version | Description |
---|---|---|
--theme <THEME_ID> | Store theme id (it can be found with the list command) | |
--live | -l | Pushes the live (published) theme. |
--development | -d | Pushes to your development theme. If you don't have a development theme, then one is created. |
--only | -o | Uploads only the specified files to SHOPLINE. Specify multiple patterns by using the flag multiple times in a single command. Accepts references to files in the following formats: - Simple file names: templates/collection.temp.json - Wildcards: config/*_secret.json , *.jpg |
--ignore | -x | Skips uploading the specified files to SHOPLINE. Specify multiple patterns to ignore by using the flag multiple times in a single command. Accepts references to files in the following formats: - Simple file names: templates/collection.temp.json - Wildcards: config/*_secret.json , *.jpg |
--nodelete | -n | Pushes your local files without deleting remote files from SHOPLINE. |
--allow-live | -a | Allows SHOPLINE CLI to overwrite the live (published) theme. |
--live | -l | Pushes to the live (published) theme. This option doesn't require --theme or --allow-live. |
--publish | -p | After the theme is pushed, publishes the theme so it is live in the store. |
--unpublished | -u | Uploads the theme to the theme library as a new unpublished theme. You're prompted to provide a name for the theme. Use the --theme flag to provide a name as a part of the command. |
--path <PATH> | The path to your theme directory. | |
--environment <ENV_NAME> | -e <ENV_NAME> | The environment that you want to use. |
package
Packages your local theme files into a ZIP file that can be uploaded to SHOPLINE.
Only directories that match the default SHOPLINE theme folder structure are included in the package.
The ZIP file uses the name theme_name-theme_version.zip
, based on parameters in your settings_schema.json file.
shopline theme package
Optional parameters
Parameter | Short version | Description |
---|---|---|
--path <PATH> | The path to your theme directory. |
list
Lists the themes in your store, along with their IDs and statuses.
shopline theme list
Optional parameters
Parameter | Short version | Description |
---|---|---|
--environment <ENV_NAME> | -e <ENV_NAME> | The environment that you want to use. |
console
Starts the SHOPLINE Handlebars REPL (read-eval-print loop) tool. This tool provides an interactive terminal interface for evaluating Handlebars code and exploring Handlers objects, helpers.
To start the tool, use the command:
shopline theme console
You can also provide context to the console using a URL, as some Handlebars objects are context-specific. For example:
shopline theme console --url /products/handle
Optional parameters
Parameter | Short version | Description |
---|---|---|
--url <URL> | The URL used as context for the console data. Some Handlebars objects and entrypoints are only available in specific templates, or return different values in different contexts. If you don't provide a URL, then the code that you provide is run in the context of the store's index page (/). Learn more about object access. | |
--environment <ENV_NAME> | -e <ENV_NAME> | The environment that you want to use. |