Title: Bash script for creating no-plugin blocks
Last modified: July 27, 2023

---

# Bash script for creating no-plugin blocks

 *  Resolved [Guido Goluke](https://wordpress.org/support/users/majorlabel/)
 * (@majorlabel)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/bash-script-for-creating-no-plugin-blocks/)
 * I often write custom blocks for my block-themes, and I use the `npx` creation
   tool to do that. Because I want to include the blocks in my theme directory, 
   and not as separate plugins, I use the ‘`--no-plugin`‘ option to generate the
   block and perform some extra steps to get the webpack automation going. I’ve 
   wrapped this into a Bash script [here](https://gist.github.com/Luke1982/3f23fca6de0ba9f529cfecf5c82ce1e8).
 * I use it like this: I create a ‘blocks’ directory in my theme, and in there I
   place the Bash-script. I then create a block with
 * `bash create-block.sh -a MajorLabel -n majorlabel -t "My First Block"`
 * Where the ‘a’ option is the author name, the ‘n’ option is the namespace (use
   all lowercaps and no spaces) and ‘t’ is the block title (Remember to surround
   in double quotes).
 * It will generate a directory which you can then change into and perform `npm 
   start` to get busy developing. All you need to do is include the `index.php` 
   file in the block directory in your `functions.php` file, which you could also
   do with
 *     ```wp-block-code
       foreach ( glob( __DIR__ . '/blocks/*/index.php' ) as $file ) {
           require_once $file;
       }
       ```
   
    -  This topic was modified 2 years, 10 months ago by [Guido Goluke](https://wordpress.org/support/users/majorlabel/).
    -  This topic was modified 2 years, 10 months ago by [Guido Goluke](https://wordpress.org/support/users/majorlabel/).
    -  This topic was modified 2 years, 10 months ago by [Guido Goluke](https://wordpress.org/support/users/majorlabel/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbash-script-for-creating-no-plugin-blocks%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Steve Dufresne](https://wordpress.org/support/users/dufresnesteven/)
 * (@dufresnesteven)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/bash-script-for-creating-no-plugin-blocks/#post-16969831)
 * Cool! Thanks for sharing the script.
 * We also had to [write some build logic](https://github.com/WordPress/wporg-mu-plugins/blob/trunk/bin/build.js)
   to build blocks for wp.org.
 * I’m going to resolve this ticket since this is a support forum and there doesn’t
   appear anything to help with. I would encourage you to get a blog up somewhere
   for more visibility! I’m sure this could be useful for others.
 *  Thread Starter [Guido Goluke](https://wordpress.org/support/users/majorlabel/)
 * (@majorlabel)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/bash-script-for-creating-no-plugin-blocks/#post-16970555)
 * [@dufresnesteven](https://wordpress.org/support/users/dufresnesteven/) Great,
   your build script does no inherent watching right? You’d have to call it from
   watching process?
 *  [Steve Dufresne](https://wordpress.org/support/users/dufresnesteven/)
 * (@dufresnesteven)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/bash-script-for-creating-no-plugin-blocks/#post-16975626)
 * Yes, exactly. ([Reference](https://github.com/WordPress/wporg-mu-plugins/blob/ccac638c0940d072e53bc6e4beed5a7b724d697f/bin/watch.js#L89))

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Bash script for creating no-plugin blocks’ is closed to new replies.

## Tags

 * [blocks](https://wordpress.org/support/topic-tag/blocks/)
 * [gutenberg](https://wordpress.org/support/topic-tag/gutenberg/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [Steve Dufresne](https://wordpress.org/support/users/dufresnesteven/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/bash-script-for-creating-no-plugin-blocks/#post-16975626)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
