Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>JS Block GeneratorNew to Visual Studio Code? Get it now.
JS Block Generator

JS Block Generator

Jesper Sundén

|
32 installs
| (0) | Free
Create folder structur for new block
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JS Block Generator

This is a Visual Studio Code extension that helps in generating new blocks for your projects.

Features

  • Generate new blocks with a simple command.
  • Automatically modifies register-blocks.php to include the new block.
  • Generates a JSON template for the new block.

Requirements

  • Visual Studio Code
  • Node.js

Installation

  1. Clone this repository.
  2. Run npm install in the project root.
  3. Open the project in Visual Studio Code.
  4. Press F5 to start the extension.

Usage

  • Run the command Generate new block from the command palette (Ctrl+Shift+P or Cmd+Shift+P on Mac) to generate a new block.

Extension Settings

This extension contributes the following settings:

  • js-block-generator.acfRegisterFunctionName: The name of the function that registers the block inside the register-blocks.php file (default: "acf_register_block").
  • js-block-generator.acfAllowedBlockTypes: The name of the function that sets allowed block types inside the register-blocks.php file (default: "sb_allowed_block_types").
  • js-block-generator.blockPath: The path where new blocks should be created (default: "./blocks").
  • js-block-generator.createScssFolder: Whether the extension should create a SCSS folder (default: false).
  • js-block-generator.acfEnqueueStyles: Whether the extension should create a SCSS folder (default: false).
  • js-block-generator.modifyEnqueueStylesFunctionName: The name of the function that enqueue block styles inside the register-blocks.php file (default: "sb_enqueue_block_styles").

Known Issues

  • register-blocks.php file must exist in the inc directory of the root path.

Release Notes

Refer to CHANGELOG.md for release notes.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft