3 Star 6 Fork 0

Gitee 极速下载 / gutenberg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/WordPress/gutenberg/releases
克隆/下载
readme.md 2.28 KB
一键复制 编辑 原始数据 按行查看 历史
Sören Wrede 提交于 2020-08-05 00:17 . Fix typos in docs (#24361)

Create a Block Tutorial

Let's get you started creating your first block for the WordPress Block Editor. We will create a simple block that allows the user to type a message and styles it.

The tutorial includes setting up your development environment, tools, and getting comfortable with the new development model. If you are already comfortable, try the quick start below, otherwise step through whatever part of the tutorial you need.

Prerequisites

The first thing you need is a development environment and tools. This includes setting up your WordPress environment, Node, NPM, and your code editor. If you need help, see the setting up your development environment documentation.

Quick Start

The @wordpress/create-block package exists to create the necessary block scaffolding to get you started. See create-block package documentation for additional features. This quick start assumes you have a development environment with node installed, and a WordPress site.

From your plugins directory, to create your block run:

npx @wordpress/create-block starter-block

The above command creates a new directory called starter-block, installs the necessary files, and builds the block plugin. If you want an interactive mode that prompts you for details, run the command without the starter-block name.

You now need to activate the plugin from inside wp-admin plugins page.

After activated, go to the block editor and use the inserter to search and add your new block.

Table of Contents

The create a block tutorials breaks down to the following sections.

  1. WordPress Plugin
  2. Anatomy of a Gutenberg Block
  3. Block Attributes
  4. Code Implementation
  5. Authoring Experience
  6. Finishing Touches
1
https://gitee.com/mirrors/gutenberg.git
git@gitee.com:mirrors/gutenberg.git
mirrors
gutenberg
gutenberg
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891