@bigcommerce/stencil-paper

中文文档
5.4.5发布于 2026/08/18BSD-4-ClauseCommonJS构建来源已验证近 30 天下载 1万

A Stencil plugin to load template files and render pages using backend renderer plugins.

原始使用文档

stencil-paper

Build Status npm (scoped)

stencil-paper is a plugin for stencil-cli. Its duty is to load templates and translations, and call out to paper-handlebars to render pages.

Usage

Load Paper into your app:

const Paper = require('@bigcommerce/stencil-paper');

Instatiate paper passing siteSettings, themeSettings, assembler, and an optional logger (overriding the default logger):

const paper = new Paper(siteSettings, themeSettings, assembler, logger);

The assembler is the interface that Paper uses to load the templates and translations. This way we can use paper to load the templates from the file system or any other source. It's just an object that implements two methods: getTemplates() & getTranslations():

const assembler = {
    getTemplates: (path, processor) => {
        return new Promise((resolve, reject) => {
            // implement me
            resolve(processor(templates));
        });
    },
    getTranslations: () => {
        return new Promise((resolve, reject) => {
            // implement me
            resolve(translations);
        });
    }
};

Now we can load the theme for the page we want to render:

paper.loadTheme(path, 'en').then(() => {
    paper.render(path, context).then(html => {
        reply(html);
    });
});

Helpers Reference

See the stencil API reference for documentation on the available helpers.

License

Copyright (c) 2015-2022, 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-paper 共发布 181 个版本,首次发布于 2016/03/08;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.4.5latest2026/08/182 个月前
5.4.42026/07/293 个月前
5.4.32026/07/143 个月前
5.4.22026/06/114 个月前
5.4.12026/03/317 个月前
5.4.02025/12/1910 个月前

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

@bigcommerce/stencil-paper 是什么?

A Stencil plugin to load template files and render pages using backend renderer plugins.

如何安装 @bigcommerce/stencil-paper?

在项目目录运行 npm install @bigcommerce/stencil-paper,或使用 pnpm add / yarn add / bun add。

@bigcommerce/stencil-paper 支持 TypeScript 吗?

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

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

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

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

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

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

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

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

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