Grunt-init plugin and theme templates TDD-ready

I’ve updated my theme and plugin templates for grunt-init adding Composer to manage dependencies and making both themes and plugins TDD-able out of the box thanks to tdd-helpers.

Installing the templates

Using Terminal browse to the ~/.grunt-init folder and clone there the templates

git clone
git clone

Using the templates

If grunt-init and composer commands are already installed then scaffolding a theme requires browsing to the WordPress themes folder

mkdir new-theme
cd new-theme
grunt-init wp-theme

and after having answered the templates questions

composer install
npm install

and then use grunt watch to have grunt compile in the background while working on the theme or plugin.
Scaffolding a plugin is similar and will require browsing to the plugins folder and

mkdir new-plugin
cd new-plugin
grunt-init wp-plugin

and following steps are the same.

Sugar to me

I’ve enclosed previously global constants in class properties to leave a cleaner global space and that will allow, as an example, getting the path to the theme scripts folder using code like


and similarly in a plugin context