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.


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, which configures how to run a BigCommerce store locally.
start Starts up the BigCommerce store, using theme files in the current directory.
bundle Bundles up the theme into a structured .zip file, which can be uploaded to BigCommerce
push Bundles the theme into .zip file; then directly uploads the .zip to igCommerce.
release Creates a new release in a theme’s GitHub repository.
help display 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.

Usage:

stencil help [<COMMAND>]

Example:

~ $ stencil help
Usage: stencil [options] [command]

Options:
  -V, --version  output the version number
  -h, --help     output usage information
...

stencil init

Creates a .stencil file used to configure the live preview when stencil start is run. The configuration information can be specified using the optional switches; if the configuration information is not specified via options, a prompt for the information will be displayed.

Usage:

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
--url [<STORE_URL>] -u The BigCommerce storefront URL

stencil start

Starts the live theme preview using the theme files in the current directory.

Usage:

stencil start [-V|--version] [-o|--open] [-v|--variation] [-t|--test] [-t|--tunnel] 
stencil start [-e|--theme-editor] [-n|--no-cache] [--theme-editor-port <PORT>]
stencil start [-h|--help]

Example:

stencil start --open # opens live theme preview in default browser
Option Alias Description
--version -V Outputs the version number
--open -o Automatically open default browser
--variation [<NAME>] -v Set which theme variation to use while developing
--test -t Enable QA mode which will bundle all javascript for speed to test locally
--tunnel Create a tunnel URL which points to your local server which anyone can use
--theme-editor -e Run Theme Editor server
--no-cache -n Turns off caching for API resource data (cache refreshes every 5 minutes)
--theme-editor-port [port] Run the Theme Editor on a different port
--help -h output usage information

Authentication Errors

If you receive an Unauthorized, please use a valid username/token error, authentication has failed. Check the API token 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.

Usage:

stencil bundle

stencil push

Bundles up the theme into a structured .zip file; then directly uploads (pushes) the .zip to BigCommerce.

Usage:

Usage: stencil push [<OPTIONS>]
Option Alias Description
--version -V Outputs the version number
--host [HOSTNAME] Specify the API host (default: https://api.bigcommerce.com)
--file [<FILENAME>] -f Specify the filename of the bundle to upload
--save [<FILENAME] s Specify the filename to save the bundle as
--activate [<VARIATIONNAME>] -a Skips activation prompt; specify variation or leave blank to select first variation
--help -h Output usage information.

Example:

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 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 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.

Usage:

stencil release [<OPTIONS>]
Option Alias Description
--version -V Outputs the version number
--help -h Output usage information.

Resources

Related Articles