@bigcommerce/stencil-cli

中文文档
10.1.2发布于 2026/11/05BSD-4-ClauseES Module构建来源已验证近 30 天下载 1.1万

CLI tool to run BigCommerce Stores locally for theme development.

原始使用文档
文档目录11 节
  1. Install
  2. Usage
  3. Features
  4. BrowserSync
  5. Sass compiling
  6. Autoprefixer
  7. How to get help or report a bug
  8. Development
  9. Versioning and releases
  10. Running in docker
  11. License

Stencil CLI

npm (scoped) tests

The BigCommerce server emulator for local theme development.

Install

Note: Stencil requires the Node.js runtime environment, version 24.x or later is required.

Run npm install -g @bigcommerce/stencil-cli.

Visit the installation guide for more details.

Usage

Usage: stencil [options] [command]

Commands:

  init        Interactively create a .stencil file 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 zip file which can be uploaded to BigCommerce.
  release     Create a new release in the theme's github repository.
  push        Bundles up the theme into a zip file and uploads it to your store.
  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.
  debug       Prints environment and theme settings for debug purposes.
  help [cmd]  display help for [cmd]

Options:

  -h, --help     output usage information
  -V, --version  output the version number

Run stencil init at the top level of your Stencil Theme. It will ask you a few questions to get your started.

Run stencil start to run a local server so you can start developing your theme.

Run with -o or --open to automatically open up a browser.

  • While stencil is running, you can type "rs" and then hit enter to auto-reload all browsers. This is similar to Nodemon's rs option.

Makeswift preview

If Makeswift is enabled for the storefront, stencil start opens a Cloudflare quick tunnel with cloudflared. If cloudflared is not on your PATH (or is too old), Stencil CLI asks if it can download a pinned, checksum-verified release. If you agree, it caches the release in <cache dir>/stencil-cli/cloudflared/<version>/. If you decline, or the terminal is not interactive, stencil start continues without Makeswift preview. The cache dir is ~/Library/Caches on macOS, %LOCALAPPDATA% on Windows, and $XDG_CACHE_HOME or ~/.cache on other systems.

To use your own binary and turn off the download (for example, offline), set STENCIL_CLOUDFLARED_PATH to the path of cloudflared.

Run stencil bundle to validate your code and create a zip bundle file that can be uploaded to BigCommerce.

Run stencil release to tag a new version of your theme, create a GitHub release in your theme repository, and upload the zip bundle file to the release assets. This is useful for tracking your changes in your Theme, and is the tool we use to create new releases in BigCommerce Cornerstone theme.

Run stencil push to bundle the local theme and upload it to your store, so it will be available in My Themes. To push the theme and also activate it, use stencil push -a. To automatically delete the oldest theme if you are at your theme limit, use stencil push -d. These can be used together, as stencil push -a -d. You can apply the theme to multiple storefronts, just specify ids of desired storefronts/channels after -c option stencil push -a -c 123 456 789. If you want to apply theme to all available storefronts, just use -allc option: stencil push -a -allc.

Run stencil pull to sync changes to your theme configuration from your live store. For example, if Page Builder has been used to change certain theme settings, this will update those settings in config.json in your theme files so you don't overwrite them on your next upload.

Run stencil debug to get information about runtime environment and the configuration

Features

BrowserSync

Stencil CLI comes packaged with BrowserSync so you can take advantage of all of those amazing goodies! Have a look at their web site for more information.

Sass compiling

You can compile Sass (node-sass) scss files in assets/scss into CSS. For example, add an scss file named theme.scss to assets/scss and {{{stylesheet 'assets/css/theme.css'}}} to your theme HTML template. Stencil-CLI will compile assets/scss/theme.scss to CSS on the fly.

Autoprefixer

Stencil CLI comes packaged with Autoprefixer. You can set which browsers should be targeted, as well as if it should cascade the generated rules in the theme's config.json file with these options:

  • autoprefixer_cascade - Defaults to true.
  • autoprefixer_browsers - Defaults to ["> 1%", "last 2 versions", "Firefox ESR"].

How to get help or report a bug

If you need any help or experience any bugs, please create a GitHub issue in this repository.

Development

If you would like to improve this project check out the Contributing Guide. Also, you can find the implementation details there.

Versioning and releases

Stencil CLI uses Semantic Release. The commit message used when a pull request is merged determines the next version.

Use Conventional Commits for pull request titles and merge commit messages:

  • fix: creates a patch release.
  • feat: creates a minor release.
  • A breaking change creates a major release. Add BREAKING CHANGE: as a commit footer, or append ! to the commit type (for example, feat!:).

For example:

feat!: require Node.js 24

After the pull request is merged, Semantic Release creates the GitHub release and publishes the new version to npm. See the Contributing Guide for more information.

Running in docker

There is possibility to run stencil-cli in docker. Here are steps to have this functionality.

First, pull the image from Github Packages (docker registry): docker pull ghcr.io/bigcommerce/stencil-cli

Then, you want to run some commands against your theme.

For example docker run -p 3005:3005 -v /bigcommerce/cornerstone:/usr/src/app -it ghcr.io/bigcommerce/stencil-cli stencil init, where 3005 is port number definded in config.stencil.json and /bigcommerce/cornerstone path to where theme is located.

docker run -p 3005:3005 -v /bigcommerce/cornerstone:/usr/src/app -it ghcr.io/bigcommerce/stencil-cli stencil start and so on

License

Copyright (c) 2015-present, BigCommerce Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by BigCommerce Inc.
  4. Neither the name of BigCommerce Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY BIGCOMMERCE INC ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BIGCOMMERCE INC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

版本与发布记录

@bigcommerce/stencil-cli 共发布 195 个版本,首次发布于 2016/10/22;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
10.1.2latest2026/11/052 天前
10.1.12026/10/2415 天前
10.1.02026/10/2019 天前
10.0.02026/09/081 个月前
9.2.02026/09/032 个月前
9.1.02026/07/233 个月前

其他发布通道:beta → 7.0.0-beta2。

关于 @bigcommerce/stencil-cli 的常见问题

@bigcommerce/stencil-cli 是什么?

CLI tool to run BigCommerce Stores locally for theme development.

如何安装 @bigcommerce/stencil-cli?

在项目目录运行 npm install @bigcommerce/stencil-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 stencil、stencil-init、stencil-pull、stencil-push、stencil-debug、stencil-start、stencil-bundle、stencil-release、stencil-download、stencil-scss-autofix、stencil-attributes-analyzer,可以用 npx stencil 直接运行。

@bigcommerce/stencil-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/bigcommerce__stencil-cli 是否存在。

@bigcommerce/stencil-cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@bigcommerce/stencil-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bigcommerce/stencil-cli 可以商用吗?

@bigcommerce/stencil-cli 使用 BSD-4-Clause 许可。声明的许可为 BSD-4-Clause,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@bigcommerce/stencil-cli 的下载量有多少?

根据 npm 官方下载统计,@bigcommerce/stencil-cli 在 2026/10/08 – 2026/11/06 这 30 天内被下载 11,016 次,日均约 367 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bigcommerce/stencil-cli 还在维护吗?

最新版本 10.1.2 发布于 2026/11/05(2 天前);至今共发布 195 个版本,其中过去 12 个月发布了 10 个;首次发布于 2016/10/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。