create-block-theme
- Scaffolds a Wordpress block theme with a single command
- Exposes npm scripts that help in block theme development
Installation
Install create-block-theme with npm
npm install -g @xylocone/create-block-theme
Usage
create-block-theme <theme-slug>
or
cbt <theme-slug>
Template types
create-block-theme
currently supports two template types: plain and tailwind:
create-block-theme <theme-slug> --template=<plain|tailwind>
If --template
flag is not passed, the user is prompted to select the template type from a list.
npm Scripts
The scaffolded theme will have the following npm scripts (that use @wordpress/scripts
and @xylocone/block-utils
):
-
start
- Start the development server for blocks in the theme -
build
- Output an optimized build for blocks in the theme -
import
- Convert Site-Editor-exported data into the theme -
import:watch
- Watch zip files and import them into the theme if they contain Site-Editor-exported data -
add-block
- Add a block to the theme
Run these scripts in the root of your scaffolded theme, with:
npm run <script-name>