Since I’m always looking for ways to improve my productivity, I constantly strive to streamline my development workflow. Lately, that meant adding Grunt to the mix.
To make it easier to use Grunt with new WordPress projects, we’ve created two project templates: grunt-wp-plugin and grunt-wp-theme. These templates make it easy to kickstart development of a new WordPress plugin or theme by building out the directory structure and project’s core files for you.
If you’re building a plugin, you will start out with the core plugin file, the basic WordPress.org readme standard, and a basic directory structure for all of your PHP, CSS, JS, and image assets. The template also configures your plugin textdomain and registers a few useful constants and core functions. Here’s an example of grunt-wp-plugin in action:
If you’re building a theme, you start out with several basic theme files: index.php, functions.php, style.css, etc. The template include an a placeholder screenshot and queues up your initial theme textdomain for internationalization. Other goodies include a custom humans.txt file for your project, pre-inserted into your theme’s header, so you can give your team credit for their contributions. Here’s an example of grunt-wp-theme in action:
Both project templates will also build a basic Gruntfile so you can automatically process Sass/LESS source files, run JSHint on your scripts, and even concatenate and minify those scripts for production.
Like WordPress and Grunt, these project templates are open source and are freely available on our team Github page. Feel free to fork, extend, and contribute!