ModernWPdev.co

create-acf-block CLI

A command line tool for stubbing out new blocks with Advanced Custom Fields

create-acf-blo

1. Download the package

The create-acf-block CLI is a composer package.

composer global require joeyfarruggio/create-acf-block

2. Ensure Global Composer Binaries are in Your PATH

If it’s your first time installing a global Composer package, ensure that the global Composer binaries directory is in your system’s PATH. This will allow you to run the create-acf-block command globally.

To find out the path to your global composer binaries:

composer global config bin-dir --absolute

The command above will output a path. You need to add this path to your system’s PATH. Below are instructions based on your operating system:

macOS and Linux

For most folks, your global composer binaries are in ~/.composer/vendor/bin. If that’s the case for you, add it to your .bashrc, .bash_profile, or .zshrc file:

export PATH=~/.composer/vendor/bin:$PATH

Windows

(Disclaimer: I don’t use Windows, so I had GPT write this section)

  1. Right-click on the Computer icon and choose Properties.
  2. Click on the Advanced system settings link.
  3. Click on the Environment Variables button.
  4. In the System Variables section, find the PATH variable, select it, and click Edit.
  5. In the Edit Environment Variable window, add a semicolon to the end of the value and then append the path to your global composer binaries.
  6. Click OK to save your changes.

3. Using the CLI

After installation, you can utilize the CLI tool globally:

create-acf-block

Follow the on-screen prompts to create your ACF block.

The first tme you run the command you will be see a series of config prompts. If you ever need to reset these you can run create-acf-block set-config.

modernWPdev Slack

Join over 130 other devs for free

    Joey Farruggio

    I'm Joey 👋,

    I've been building with WordPress for almost 10 years. I create tools for developers serve clients as an contract web developer.