There are few steps necessary to prepare a plugin for release on the WordPress.org plugin directory. We use Gulp to automate this.
- Download and install Node.js and npm.
- In a terminal, navigate to the root of the plugin directory and run
npm install
- Get some coffee while npm installs the required packages.
There are two build tasks, build:release
and build:dev
.
The release task performs the following subtasks:
- Updates the version number in the
{plugin-name}.php
andreadme.txt
files. - Compiles LESS files to CSS.
- Minifies JavaScript files and adds a
.min
suffix. - Copies all files to a
dist/{plugin-name}
folder. - Creates a
.zip
archive with the appropriate filename ready for uploading to wordpress.org.
Release task usage:
gulp build:release -v version
Where version
should be replaced with the required version number.
For example, say the next version of the plugin is 1.2.3:
gulp build:release -v 1.2.3
The dev build task only has one subtask:
- Watch LESS files for changes and compile to CSS.
This is simply to avoid having to manually recompile LESS files while working on them.