Lab - Getting Started with the Stencil CLI
Lab - Getting Started with the Stencil CLI
Lab - Getting Started with the Stencil CLI
Developing a custom Stencil theme usually starts with cloning the official default theme, Cornerstone. To develop effectively in a local environment, you’ll use the Node.js-based Stencil CLI tool to run a local server, connecting your custom theme code to your BigCommerce store data.
In this lab, you will:
Prerequisites
To successfully complete this tutorial, you will need the following:
Node Version Manager (nvm) is an alternative way to install Node.js and allows you to install and use different versions.
With nvm installed, you can install a specific version:
nvm install 20
… and switch to the Node.js runtime of any version you have installed:
nvm use 20
Whether you use nvm or install Node.js via another method, make sure you are running a compatible version:
node -v
You’ll use this API account in a later lab to bundle and publish your theme. For proper access control, you should create a separate account with the “local development only” access level for any team members who should have permission to develop on the theme but not upload it.
This step only needs to be performed once for a specific version of Node.js.
Remember to make sure you have Node.js 20 or later running before installing the package. If you’re using Node Version Manager:
nvm use 20
The command will install the stencil-cli package globally. This will allow you to use it in multiple Stencil theme projects using the same version of Node.js.
ARM Based Macs
For ARM based Macs, you will need to run the following before installing the package:
arch -x86_64 /bin/zsh
Installing Dependencies on Windows
See the BigCommerce documentation for more details on options for installing dependencies on Windows before installing the Stencil CLI package.
You should now have a complete copy of the Cornerstone theme source files, with dependencies installed in the node_modules directory.
This step only needs to be performed once for a given Stencil theme project locally.
You’ll need the access token you recorded after creating the API account in your control panel.
This init command will generate a configuration file connecting your local theme package with your store.
You may also choose to run the command with no options:
stencil init
This will result in interactive prompts allowing you to provide appropriate values.
After the dev server starts, you should see output printing the local URL(s) you can use to access the preview.

http://localhost:3000 if you used the 3000 port in the init command. Verify that your storefront is loaded in the browser.
You should leave the dev server process running in your terminal as you customize and preview your theme. When you’re ready to stop the server, simply cancel the process (Ctrl+C).
Run stencil start from within your theme directory at any time to restart the dev server.