Skip to content

WordPress/gutenberg-examples

trunk
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

* Add e2e utils package.

* Adds .eslintrc

* Add e2e to CI

* Add tests for first 5 blocks.

* Add remaining tests and snapshot data.

* Fix syntax error.

* Use correct script name.

* Remove import approach to test for timeout.

* Add e2e workflow.

* Spaces.

* Use inline snapshots and increase test timeout.

* Move all tests into /tests in  corresponding block directory and rename them basis.spec.js.

* Change timeout to 30 seconds to match changes in scripts package.

* Remove tests from the first three blocks to reduce ramp up.

* Remove timeout change.

* Update packages.

* Revert "Update packages."

This reverts commit 22c30d3.

* Update packages.

* Remove test directory. The tests don't work and have to real use.

* Move basic block e2e tests into corresponding directory.

* Ignore the e2e folders when linting js.

* Add build to e2e workflow.

* Spaces, not tabs 🤦

* Update .github/workflows/e2e-tests.yml

Co-authored-by: Stephen Edgar <stephen@netweb.com.au>

* Update .github/workflows/e2e-tests.yml

Co-authored-by: Stephen Edgar <stephen@netweb.com.au>

* Add changes to the build process per code review.

* Whitespace issues.

* Update .github/workflows/e2e-tests.yml

Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>

---------

Co-authored-by: Stephen Edgar <stephen@netweb.com.au>
Co-authored-by: Greg Ziółkowski <grzegorz@gziolo.pl>
64cfa69

Git stats

Files

Permalink
Failed to load latest commit information.

Gutenberg Examples

Demo

Examples for extending Gutenberg with plugins which create blocks.

See also: Gutenberg developer documentation

Installation

Gutenberg Examples are distributed as WordPress plugin.

  1. Download the gutenberg-examples.zip archive of the latest release.

    Do not download from the "Clone or download" GitHub button, as this includes the source material only. Read the Development instructions below if you’re interested in building your own copy of the plugin.

  2. Navigate to the Plugins > Add new screen in your WordPress administrative dashboard.
  3. Click Add New at the top of the page.
  4. Click Upload Plugin at the top of the page.
  5. Click Choose File, then find and Upload the downloaded zip file.
  6. After the plugin finishes installing, click Activate.
  7. You’re done!

Development

This project uses the @wordpress/env package to provide a local development environment. Before you can use the development environment, you must install Docker.

Once Docker is installed, clone this project and enter the working directory:

git clone git@github.com:WordPress/gutenberg-examples.git
cd gutenberg-examples

Then, install the project dependencies:

npm install

Once installed, start the local WordPress instance with one of two commands:

  1. npm run env:start - Starts the instance normally.
  2. npm run env:start:debug - Starts the instance with debugging enabled.

The WordPress instance will be available at http://localhost:8888/. You can login with the username and password "admin" and the password "password" at http://localhost:8888/wp-login.php. The plugin should be automatically activated.

To stop this local WordPress instance later run:

npm run env:stop

To install the node packages

npm install

This repository does not version the built files for any of the examples. You can build all of the examples by running npm run build:all in the project root.

Local Development

In this repository, there are block and non-block examples and each have their own build process.

Block examples are stored in the blocks-jsx and blocks-non-jsx directories while and other non-block examples are stored in the non-block-examples directory.

Note: The blocks stored in blocks-non-jsx do not use JSX and therefore do not require a build process

  • npm run start - Builds development versions of the blocks and watches for changes to files to automatically rebuild as you develop.

  • npm run build - Generates production files for the block examples.

  • npm run start:non-block - Builds development versions of the non-block examples and watches for changes to files to automatically rebuild as you develop.

  • npm run build:non-block - Generates production files for the non-block examples.

  • npm run build:all - Generates production files for all examples



Code is Poetry.