Stencil CLI Options and Commands
This article is a comprehensive command reference for Stencil CLI, BigCommerce's powerful theme development and deployment tool. For installation instructions for your OS, see Installing Stencil CLI. For more information on BigCommerce's Stencil Theme Engine, see About Stencil. Continue reading below for detailed information on each Stencil CLI command and option.
BigCommerce is currently sunsetting its node-sass fork in favor of the latest sass/node-sass (opens in a new tab). To ensure that your storefront is up to date, use the latest active or maintenance node version in Stencil CLI and use the CLI command to resolve incompatible SCSS directives, which can cause issues with the styling of your storefront. Your current production site will continue to function as designed, but all future updates will require you to address any SCSS compatibility issues with Node.js 18. This upgrade is necessary to ensure the security of our platform and that you are not running out-of-date packages that may expose your projects to additional security vulnerabilities.
Commands overview
The syntax to run a Stencil CLI command is as follows:
stencil COMMANDS [OPTIONS] <PARAMETERS>
Running stencil help
outputs a full list of commands and their descriptions. For more detailed information and usage examples, click a link in the table below:
Command | Description |
---|---|
init | Interactively creates a .stencil file or secrets.stencil.json and config.stencil.json files (if using Stencil V3.1 release or later), which configures how to run a BigCommerce store locally. |
start | Starts up the BigCommerce storefront local development environment, using theme files in the current directory and data from the live store. |
bundle | Bundles up the theme into a structured .zip file, which can be uploaded to BigCommerce. |
pull | Pulls the configuration from the active theme on your live store and updates your local configuration. |
download | Downloads the theme files from the active theme on your live store, overwriting local files if desired. |
push | Bundles the theme into .zip file; then directly uploads the .zip to BigCommerce. |
release | Creates a new release in a theme's GitHub repository. |
help | Displays help and returns all the options available to use for the specified command. |
stencil help
Displays help and returns all options available for the specified command.
stencil help COMMAND
~ $ stencil help
Usage: stencil [OPTIONS] COMMAND
Options:
-V, --version output the version number
-h, --help output usage information
...
stencil init
Creates a .stencil
file or secrets.stencil.json
and config.stencil.json
files (if using Stencil V3.1 release or later) used to configure the live preview when stencil start
is run. You can specify the configuration information using the optional switches; if you do not specify the configuration information via options, Stencil CLI will prompt you to do so.
NOTE: For custom templates, use only the config.stencil.json
file. The config.stencil.json
file contains theme-related configuration information like store URL, custom templates, etc. The secrets.stencil.json
file contains the access token.
stencil init [--url STORE_URL] [--token API_TOKEN]
Option | Alias | Description |
---|---|---|
--port HTTP_PORT | -p | The HTTP port number to use when serving the live theme preview. |
--token API_TOKEN | -t | The BigCommerce API Token (opens in a new tab). |
--url STORE_URL | -u | The BigCommerce storefront URL. |
stencil start
Starts the live theme preview using the theme files in the current directory.
stencil start [-V|--version] [-o|--open] [-v|--variation] [-t|--test] [-t|--tunnel] [-vb|--verbose]
stencil start [-h|--help]
stencil start --open # opens live theme preview in default browser
Option | Alias | Description |
---|---|---|
--version | -V | Output the version number |
--open | -o | Automatically open default browser |
--variation NAME | -v | Set which theme variation to use while developing |
--channelId CHANNELID | -c | Set the channel id for the storefront |
--timeout | -t | Set a timeout for the bundle operation. Default is 20 secs |
--tunnel | Create a tunnel URL that points to your local server, which anyone can use. The required password for external connections is your public IP address. | |
--no-cache | -n | Turn off caching for API resource data (cache refreshes every 5 minutes) |
--verbose | -vb | Enable verbose logging |
--help | -h | Output usage information |
--theme-editor and --theme-editor-port [port]:
BigCommerce deprecated -theme-editor
and --theme-editor-port [port]
options as of v1.23.1. Please use Page Builder instead.
Authentication errors
If you receive an Unauthorized, please use a valid username/token
error, authentication has failed. Make sure the API token you supplied is correct. For more information on creating store API accounts and generating tokens, see Obtaining Store API Credentials.
stencil bundle
Bundles up the theme into a structured .zip
file, which can be uploaded to BigCommerce.
stencil bundle
stencil pull
Pulls the configuration from the active theme on your live store and updates your local configuration. This is useful if any theme settings have been changed within Page Builder, as it will prevent you from overwriting them with your next theme upload by first syncing them.
stencil pull [OPTIONS]
Option | Alias | Description |
---|---|---|
--host HOSTNAME | -h | Specify the API host (default: api.bigcommerce.com ) |
--filename FILENAME | -f | Specify the filename to use for the merged configuration (default: config.json ) |
--saved | -s | Downloads the most recently saved configuration instead of the live one. |
--channel_id CHANNEL_ID | -c | Specify the channel ID of the storefront, if the store has multiple storefronts. |
--help | -h | Output usage information |
stencil pull
stencil push
Bundles up the theme into a structured .zip file
; then directly uploads (pushes) the .zip
to BigCommerce.
stencil push [<OPTIONS>]
Option | Alias | Description |
---|---|---|
--version | -V | Output the version number |
--host HOSTNAME | Specify the API host (default: api.bigcommerce.com ) | |
--file FILENAME | -f | Specify the filename of the bundle to upload |
--save FILENAME | -s | Specify the filename of the saved bundle |
--channel_ids CHANNEL_ID | -c | Specify the channel ID(s) of the storefront, if the store has multiple storefronts |
--activate VARIATIONNAME | -a | Skip activation prompt; specify variation or leave blank to select first variation |
-a -c {{channel_id_1 channel_id_2 ... channel_id_n}} | Allows you to apply a theme to selected channels (at least one channel id should be provided) | |
-a -all_channels or a -allc | Allows you to apply a theme to all available channels. | |
--delete | -d | Delete oldest private, non-active theme if upload limit reached |
--help | -h | Output usage information |
stencil push -f Cornerstone-2.3.2.zip # uploads specified file, skips bundling if file already exists
--filename:
You can use the -f
or --filename
option in cases where you have already run stencil bundle
to bundle your theme, but the resulting .zip file has not yet been uploaded to BigCommerce. Use the generated .zip file's filename as a parameter to identify the generated file in your theme directory. An example of the command is outlined below.
When you run stencil push
, you can apply one theme to multiple storefront or channels.
When you run stencil push
with the -f
or --filename
option, Stencil CLI skips all its bundling steps and diagnostics. It proceeds directly to uploading the specified file, displaying its processing progress bar to show upload status.
stencil download
Download the theme files from your live store, overwriting files in your local directory.
stencil download [OPTIONS]
Option | Alias | Description |
---|---|---|
--host HOSTNAME | -h | Specify the API host (default: api.bigcommerce.com ) |
--file FILENAME | -f | Specify a single file to download from the theme, e.g. templates/layout/base.html |
--exclude | -e | Specify a directory to exclude from the download. |
--channel_id CHANNEL_ID | -c | Specify the channel ID of the storefront, if the store has multiple storefronts. |
--help | -h | Output usage information |
stencil download -f package.json
stencil release
Creates a new release in a theme’s GitHub repository. Developers outside BigCommerce can use this for forks (not master) of Stencil’s Cornerstone base theme, or for their own parallel themes independent of Cornerstone.
stencil release [OPTIONS]
Option | Alias | Description |
---|---|---|
--version | -V | Output the version number |
--help | -h | Output usage information |