Search code examples
wordpressnode-modulespackage.jsonwordpress-gutenberggutenberg-blocks

How to share node_modules and package.json files between two directories?


As I experiment with WordPress's new Gutenberg development methods, I noticed that I need to create individual block folders within the plugins directory. These are essentially the components that makeup the front-end and editor side of things.

I would like to understand two things:

  1. How to install node_modules and package.json files so that commands are accepted when not in a specific block directory folder.

  2. I would like to run certain builds with specific scripts, what are the proper commands to hand this procedure when outside of a block directory?

How do I setup my environment so that when I type in a command, it understand to compile no matter which plugin directory I am in?


Solution

  • The create-block package has scaffolding that allows you to create blocks and the package is undergoing heavy development right now that will allow you to have multiple blocks within one folder.