Closed stevenslack closed 8 months ago
Latest commit: 71a8c3c353e698478cbc493c88931fedd06015d7
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Summary
The
wp-create-block
script from @wordpress/create-block will scaffold aviewScript
by default. This may not be necessary as many blocks do not require a view script. The result is that a stale file is scaffolded and enqueued when the developer creates a block. This may require the developer to manually remove the stale file and the block.jsonviewScript
definition.This change introduces a prompt allowing the developer to opt-in to including a viewScript block type definition and will scaffold with the scaffolded block by prompting the developer during the Alley create-block process.
Related Issue: #602
Changes
hasViewScript
to determine whether a viewScript should be scaffolded.blocklanguage
to apply the appropriate file type to the scaffolded files.Test Steps
npm install
to get all of the necessary dependencies.alley-scripts/plugin
npm run create-block
command."Will this block have a front end view script?"
view.ts|js
file will be scaffolded to the blocks directory'viewScript
definition will be present in theblock.json
file.Additional Notes