@automattic/newspack-blocks

中文文档
4.36.8发布于 2026/11/11GPL-2.0-or-later近 30 天下载 7875

=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gn

原始使用文档
文档目录5 节
  1. Setup
  2. Generating Builds
  3. Developing
  4. Building New Blocks
  5. Usage

Newspack Blocks

This plugin is meant to serve as a container for most Newspack Gutenberg blocks. There may be certain blocks that relate to specific functionality in other plugins, in which case they would live with the primary functionality, but besides this exception most will live in this one.

Setup

To get set up for block development, run composer install && npm install

Generating Builds

To generate a build of the current blocks, run npm run build.

To clean out the built blocks, run npm run clean.

Developing

To work on Block development and have Webpack watch your files for changes run: npm start.

Linting

is performed on changed files before commiting. In other words, is run during pre-commit git hook, but only on staged files. The hook is configured in composer.json.

PHPJSSCSS
toolPHPCSeslintstylelint
config.phpcs.xml.dist.eslintrc.js.stylelintrc
run manuallycomposer lintnpm run lint:jsnpm run lint:scss
autofix ✨./vendor/bin/phpcbf <file>npm run lint:js -- --fixnpm run lint:scss -- --fix

Building New Blocks

To get started with a new block:

  • Duplicate one of the example block directories in src/
  • Rename the directory to the slug of your block.
  • At minimum edit index.js and change name and title definitions.
  • Add the block slug to the production array in src/setup/blocks.json
  • If the block requires server-side code add the slug to the $newspack_blocks_blocks array in newspack-blocks.php
  • Execute npm run build. If all went smoothly, you should see a Newspack category in the block picker, and your block should appear within it.

Usage

End-user documentation can be found here.

版本与发布记录

@automattic/newspack-blocks 共发布 634 个版本,首次发布于 2021/08/26;过去 12 个月发布了 143 个版本。

版本发布日期距今
4.36.8latest2026/11/11今天
4.36.8-alpha.12026/11/064 天前
4.36.72026/11/064 天前
4.36.7-alpha.12026/10/2912 天前
4.36.62026/10/2813 天前
4.36.52026/10/2714 天前

其他发布通道:hotfix/wp-6-columns-fix → 1.50.1-hotfix.1,hotfix/update-js-version-strategy → 1.60.1-hotfix.1,hotfix/carousel-fixes → 1.65.1-hotfix-carousel-fixes.1,hotfix/carousel-init-set-aspect-ratio → 1.72.1-hotfix-carousel-init-set-aspect-ratio.1,hotfix/additional-fields-panel → 1.72.2-hotfix-additional-fields-panel.1,hotfix/harden-attributes-output → 1.74.1-hotfix-harden-attributes-output.1。

关于 @automattic/newspack-blocks 的常见问题

@automattic/newspack-blocks 是什么?

=== Newspack Blocks === Contributors: (this should be a list of wordpress.org userid's) Donate link: https://example.com/ Tags: comments, spam Requires at least: 4.5 Tested up to: 5.1.1 Stable tag: 0.1.0 License: GPLv2 or later License URI: https://www.gn

如何安装 @automattic/newspack-blocks?

在项目目录运行 npm install @automattic/newspack-blocks,或使用 pnpm add / yarn add / bun add。

@automattic/newspack-blocks 支持 TypeScript 吗?

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

@automattic/newspack-blocks 可以商用吗?

@automattic/newspack-blocks 使用 GPL-2.0-or-later 许可。强 Copyleft:分发包含该代码的软件时,整个作品需以兼容的 GPL 许可开源。仅在内部使用、不对外分发时不触发此义务。以上为概括,不构成法律意见,请以许可原文为准。

@automattic/newspack-blocks 的下载量有多少?

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

@automattic/newspack-blocks 还在维护吗?

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