Last active
May 22, 2022 04:30
-
-
Save thetwopct/f93bca73e0077a48298bbdcd3c97c962 to your computer and use it in GitHub Desktop.
Building a new Gutenberg block editor block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# npx create-block | |
# go to root of plugins folder | |
# run the following to create a directory with scripts in it | |
npx @wordpress/create-block --namespace "ttp" --title "Block Name" --short-description "Something" --category "common" --wp-scripts some-directory-name | |
# --namespace <value> internal namespace for the block name | |
# --title <value> display title for the block and the WordPress plugin | |
# --short-description <value> short description for the block and the WordPress plugin | |
# --category <name> category name for the block - common, formatting, layout, widgets, embed | |
# --wp-scripts enable integration with `@wordpress/scripts` package | |
# --no-wp-scripts disable integration with `@wordpress/scripts` package | |
# --wp-env enable integration with `@wordpress/env` package | |
cd my-new-block | |
npm start | |
npm run build && npm run format:js && npm run lint:css && npm run lint:js | |
####################### | |
$ npm start | |
Starts the build for development. | |
$ npm run build | |
Builds the code for production. | |
$ npm run format:js | |
Formats JavaScript files. | |
$ npm run lint:css | |
Lints CSS files. | |
$ npm run lint:js | |
Lints JavaScript files. | |
$ npm run packages-update | |
Updates WordPress packages to the latest version. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment