Lab - Bundle and Upload a Theme
Lab - Bundle and Upload a Theme
Lab - Bundle and Upload a Theme
The Stencil CLI tool is used not only for running a preview of your theme on a local server, but also for bundling your theme package and even automatically uploading it to your store.
In this lab, you’ll practice both bundling and automatically uploading and applying your theme.
In this lab, you will:
Prerequisites
The Stencil CLI bundle command will bundle the contents of your theme package into a zip file compatible with uploading in the BigCommerce control panel.
In order for a theme to be bundled, it must meet the following requirements:
Follow these steps to name and bundle your working theme:
config.json contains a number of other settings describing the theme, particularly under the meta key. These settings, including author information, thumbnail image, support URL, and supported features, should be completed for any theme intended for the marketplace.
The zip file will be named according to the theme name and version number stored in config.json, in the form <theme_name>-<version>.zip.
Your theme bundle file is now ready to be uploaded manually in the control panel, an action which can be found in the Themes tab, found in the Storefront section or in the settings of an individual channel in Channel Manager.

Multiple themes can be uploaded in the control panel. The theme currently applied to the storefront can be updated by taking the “Apply” action under any of the available themes.
While a theme bundle can be manually uploaded in the control panel as described above, the Stencil CLI tool can also be used to do this, as well as to automatically apply it as the storefront’s active theme.
Note that the Stencil CLI push command takes care of both bundling and uploading the theme in a single step. It is not necessary to run stencil bundle before running stencil push.
Remember that the Stencil CLI token you generated in the store control panel must be configured with the “publish theme” access level in order to successfully upload a theme.
After the initial bundling process, you will potentially get several interactive prompts from this command.
Automatically applying the theme may not work with the CLI, depending on your store configuration. The theme package will still be uploaded and can be applied manually in the control panel.
It’s also possible to use CLI options to avoid these interactive prompts. For example, specify a variation to automatically apply with —activate: