Grunt-init WordPress plugin template updated

I’ve put some love into a proper updating of the wp-plugin grunt-init template.
The template, placed in the ~/.grunt-init folder, allows for quick WordPress plugin scaffolding featuring a seed of OOP and TDD techniques, Composer managed library dependencies, and grunt powered project compilation and building.

Using the template

After grunt-init installation

npm install -g grunt-init

get hold of the template

git clone ~/.grunt-init/wp-plugin

navigate to the folder that will contain the plugin

cd ~/path/to/local/development/my-plugin

and start the templating

grunt-init wp-plugin

after answering all the questions install npm packages

npm install

update Composer

composer update

and that’s it.

Clean slate

The plugin will sport just one class that will take care of hooking into WordPress proper (the hook method) and will allow for later retrieval of plugin “constants” like the prefix and so on via the the method (double “the” not an error).
As an example to get hold of the plugin CSS assets folder I would use


and the same would go for the prefix


a singleton instance based access to the plugin main class is possible using the My_Plugin::get_instance method.

Ready for TDD

The template is built to my taste and needs and comes with TDD adapters out of the box.
Using them is as easy as calling WordPress usual methods


and will allow unit testing any class adopting them in isolation.