Themergency fooplugins.com

WP Dev Advent Calendar – Day 1 : WordPress Plugin Boilerplate Generator

| 4 Comments

Day 1 of my WordPress Developer Advent Calendar.

To say developers are lazy is an understatement. We want things done for us automatically. And if something is done manually, then we write code to automate it!

Tom McFarlin’s WordPress Plugin Boilerplate is a perfect example of great work in the WordPress community at the moment. I love the project, because you can get a new plugin off the ground in a matter of minutes.

Contribute to the project on Github if you can. Even if you don’t want to contribute code, then just comment and have your say or opinion.

I created a generator for the WordPress Plugin Boilerplate which is a grunt-init template. If you do not know what Grunt is then in a nutshell, it is a task runner written in javascript. Grunt-init is a scaffolding tool used to automate project creation, which uses Grunt under the hood. Check out the repo and follow the simple instructions to generate your first plugin in about 30 seconds flat!

Basic Usage:

  1. Install grunt-init:
    npm install -g grunt-init
  2. Clone the latest grunt-wp-boilerplate template from github:
    git clone git@github.com:fooplugins/grunt-wp-boilerplate.git ~/.grunt-init/wp-boilerplate
  3. Create a new directory in your wp-content/plugins directory
    mkdir myfirstplugin
  4. Change to the new empty directory
    cd myfirstplugin
  5. Run the grunt-init template:
    grunt-init wp-boilerplate
  6. Follow the prompts, and it will generate your new plugin, including renaming all the files correctly and replacing all the necessary variables within the files.

Enjoy!

4 comments
yaron.guez
yaron.guez

Thanks!  Trying this out now. You might want to mention that an SSH key with Github is required for step 2 to work.  Before copying my ssh key to Github line 2 resulted in this error: 

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

fxbenard
fxbenard

Works like a charm, thanks

ellen
ellen

Thanks, installed and will use. Can't wait to see your other goodies!