-
Notifications
You must be signed in to change notification settings - Fork 86
Closed
Labels
command:scaffold-blockRelated to 'scaffold block' commandRelated to 'scaffold block' command
Milestone
Description
When scaffolding a block with a command like
wp scaffold block myblock --title="My Block" --plugin=myplugin
the JavaScript file created is called block.js.
@zgordon makes the argument that index.js is preferable. His reasoning centers around when using ESNext with an import statement and you name the file index.js, it allows you to include the file in the import statement without explicitly including the filename.
You can see an example of his using import without the filename in one of his sample plugins, where he writes:
/**
* Import registerBlockType blocks
*/
import './register-block-type/';
import './demo/';
Using the current version with block.js, these lines would be
/**
* Import registerBlockType blocks
*/
import './register-block-type/block.js';
import './demo/block.js';
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
command:scaffold-blockRelated to 'scaffold block' commandRelated to 'scaffold block' command