-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an interactive variant to @wordpress/create-block
#52508
Conversation
Another question: This variant requires Gutenberg (16.2+). Where should we inform the user that Gutenberg needs to be installed in other for this to work? |
Size Change: 0 B Total Size: 1.43 MB ℹ️ View Unchanged
|
Given the current state of the Interactivity API package (still experimental), I wouldn't create a Also, ideally, this I think having a direct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me. However, I agree with @juanmaguitar that this is probably better as a template until the API is available in core. One benefit of using it's own template is that we can introduce any number of variants to show different and more complex examples
Ok, thanks for your feedback. I'll migrate this to a template and we'll merge this variant at a later point 🙂 |
@luisherranz to speed up things, I have created this PR #52549 over |
Awesome. Thank you, Juanma. |
What?
Add an
interactive
variant to the@wordpress/create-block
package.Why?
So people can use this variant to start testing the Interactivity API.
How?
I followed what @ryanwelcher did in this PR and added a new variant for an
interactive
block.I also added the possibility of adding a
viewScript
field to theblock.json
file.Testing Instructions
@wordpress/create-block
package using:cd packages/create-block
node index.js
interactive
variant.block.json
should havesupports.interactivity: true
and aviewScript
field.render.php
file should contain directives.view.js
file with an import of@wordpress/interactivity
and a call tostore()
.If you want to try that the interactivity works, you can use
wp-now
:cd (installation directory) && npm start
npx @wp-now/wp-now start
(in another terminal)Screenshots or screencast
https://www.loom.com/share/3680f3b779e14306b8a7fd5bb484988c
Questions
wp-now
and add npm scripts to run it?