How to use and create template for @wordpress/create-block --template
command?
#53701
Replies: 2 comments 1 reply
-
@juanmaguitar and @ryanwelcher, it looks like there is some gap in the documentation for Create Block regarding how to consume custom templates. |
Beta Was this translation helpful? Give feedback.
-
Hi @tresorama!
There's no list of official templates as there are no many "official templates"
The documentation about External Project Templates is here: https://developer.wordpress.org/block-editor/reference-guides/packages/packages-create-block/packages-create-block-external-template/ Some examples of templates can be found at:
Templates can be published as NPM packages so they can easily accessed from the CLI.
Yes! But there's no "starter repo". Maybe an option could be added to
I think this is not possible for the time being but could be a nice addition. Please, feel free to open an issue for specific improvements in tools and/or documentation. |
Beta Was this translation helpful? Give feedback.
-
When scaffolding a new
Block
we have the option to select a template to use for the process.Docs says that we can use a template when invoking the cli like:
I have a series of question that i think is good to make clear also for other devs.
The docs says that we can do
npx @wordpress/create-block --template /absolute-path/in-my/local/pc
How this differs from copy paste ?
Do i need to "prepare" something in my controlled directory to make the cli happy ?
4.1
Is it possible to do
npx @wordpress/create-block --template NAME_OF_NPM_PACKAGE
?If yes, there is a "starter repo" with all thing already ready to publish to npm ?
4.2
And
npx @wordpress/create-block --template PUBLIC_GITHUB_REPO_URL
?If yes, there are some specific requirements?
Resources
https://developer.wordpress.org/block-editor/getting-started/create-block
https://www.npmjs.com/package/@wordpress/create-block
Beta Was this translation helpful? Give feedback.
All reactions