There are few steps necessary to prepare a theme for release on the WordPress.org plugin directory. We use Gulp to automate this.
- Download and install Node.js and npm.
- Install gulp using
npm install -g gulp
. - In the theme folder, ensure the theme-build repository has been added as a submodule in a folder called 'build' and is up to date. This can be done using
git submodule add [email protected]:siteorigin/theme-build.git build
- In a terminal, navigate to the build directory in the theme 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:
- Extracts the name of the theme from the parent directory into a variable called
themeSlug
. - Updates the version number in the
functions.php
andreadme.txt
files. - Compiles SASS files to CSS.
- Minifies JavaScript files and adds a
.min
suffix. - Copies all files to a
dist/{themeSlug}
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 theme is 1.2.3:
gulp build:release -v 1.2.3
The dev build task only has one subtask:
- Watch SASS files for changes and compile to CSS.
This is simply to avoid having to manually recompile SASS files while working on them.
gulp updateGoogleFonts ---apiKey {YOUR_API_KEY}
The task will require an update to the build-config file in each theme to specify the name and location of the fonts file.
Vantage requires a separate script to update the Google Fonts array. For instructions, see the following Gist.