mccomaschris/parkour

A WP-CLI command to quickly scaffold ACF blocks for Timber themes. PARKOUR!

Installs: 41

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/mccomaschris/parkour

1.1.1 2026-02-05 13:56 UTC

This package is auto-updated.

Last update: 2026-02-19 18:58:37 UTC


README

PARKOUR! A WP-CLI command to quickly scaffold ACF blocks for Timber themes.

Named after the iconic Office scene where Andy, Michael, and Dwight leap around the office yelling "PARKOUR!" - because creating blocks should be just as quick and fun.

Features

  • 🚀 Interactive block creation with beautiful Laravel Prompts
  • 📦 Generates all necessary files (block.json, callback.php, Twig template)
  • 🎨 Optional JavaScript and CSS file generation
  • ✅ Follows best practices for Timber + ACF blocks
  • 🔧 Customizable templates based on your theme patterns

Requirements

  • PHP 8.3+
  • Timber
  • ACF Pro
  • WordPress with WP-CLI (optional - for WP-CLI mode)

Installation

From your theme directory, run:

cd wp-content/themes/your-theme
composer require mccomaschris/parkour --dev

Then use the standalone binary:

vendor/bin/parkour create hero-section

WP-CLI Setup (Optional)

If you prefer using WP-CLI instead of the standalone binary, create a wp-cli.yml file in your theme or project root:

require:
  - vendor/mccomaschris/parkour/src/class-blockcommand.php

For Bedrock/project-level installations, add the WordPress path:

require:
  - vendor/mccomaschris/parkour/src/class-blockcommand.php

path: web/wp  # Adjust based on your WordPress installation path

Usage

Standalone Mode (Recommended)

Run from your theme directory:

# Interactive mode
vendor/bin/parkour create

# With block name
vendor/bin/parkour create hero-section

# Skip all prompts (use defaults)
vendor/bin/parkour create hero-section --skip-prompts

# Override theme slug detection
vendor/bin/parkour create hero-section --theme=my-theme

The standalone binary:

  • Detects your theme slug from style.css "Text Domain:" header (or uses directory name)
  • Creates blocks in the current working directory
  • Works without WordPress being loaded

WP-CLI Mode

If you set up the wp-cli.yml file, you can use WP-CLI commands:

# Interactive mode
wp parkour create

# With block name
wp parkour create hero-section

# Skip all prompts
wp parkour create hero-section --skip-prompts

# Specify theme (for project-level installs)
wp parkour create hero-section --theme=your-theme-slug

Interactive Prompts

When running without --skip-prompts, you'll be prompted for:

  • Block name
  • Title
  • Description
  • Category
  • Icon
  • Keywords
  • Whether to include JS/CSS files

What Gets Created

When you create a block named hero-section, Parkour generates:

your-theme/
├── blocks/
│   └── hero-section/
│       ├── block.json
│       ├── callback.php
│       ├── hero-section.js (optional)
│       └── hero-section.css (optional)
└── views/
    └── blocks/
        └── hero-section.twig

File Structure

block.json

Standard WordPress block metadata following ACF block conventions.

callback.php

Render callback with:

  • Timber context setup
  • Block and field data
  • CSS class management
  • Background color support
  • Anchor support
  • Optional JS/CSS enqueuing

{block-name}.twig

Twig template with:

  • Block wrapper with classes
  • Anchor ID support
  • Preview mode detection
  • Field usage examples

{block-name}.js (optional)

JavaScript with:

  • Block initialization
  • DOM ready handling
  • Scoped to avoid conflicts

{block-name}.css (optional)

Styles with:

  • Block-specific selectors
  • Preview mode styles

Customization

Modify Templates

Templates are located in templates/ and use Mustache syntax. You can fork and customize:

  • block.json.mustache
  • callback.php.mustache
  • block.twig.mustache
  • block.js.mustache
  • block.css.mustache

Block Patterns

The generated blocks follow this pattern:

  • Theme prefix for all classes and functions
  • Support for background colors via ACF field
  • Automatic anchor and className support
  • Filemtime-based cache busting for assets
  • Preview mode detection in Twig

Examples

Creating an Accordion Block

wp parkour create
What is the block name? › accordion
Block title › Accordion
Block description › An accessible accordion block for organizing content
Block category › your-theme
Choose an icon › editor-justify
Keywords › accordion, faq, toggle
Include JavaScript file? › Yes
Include CSS file? › Yes

Creating Multiple Blocks

wp parkour create hero
wp parkour create cta-banner
wp parkour create testimonials