Ollie Block Academy

Creating a Block Plugin From Scratch

Using WP Scripts to build blocks – B

WP Scripts provides two essential commands: “start” for development builds with file watching, and “build” for optimized production builds. Add these to your package.json scripts section for easy access.

The start command watches your source directory and rebuilds automatically when files change, enabling rapid development feedback. It expects source code in a “src” directory with index.js as the entry point.

Successful builds generate compiled JavaScript in the build directory along with index.asset.php containing version hashes and dependency lists for WordPress to handle script enqueuing correctly.

Back to: Ollie Block Academy > Creating a Block Plugin From Scratch