Method Generator allows you to rapidly create custom builds of the Method theme using Gulp and Nunjucks.
To compile custom theme releases using the included gulp tasks, you'll need:
If you plan on using Generator to create custom builds of Method more than once, the most efficient way to get Generator is to clone the project's repo from GitHub. Once cloned, ensure that the method submodule is initialized and that the
build/ folder contain's Method's theme files.
You can also download Method Generator and add Method's files manually:
- Download the latest release of Method Generator here. Extract into a directory of your choosing.
- Download the cooresponding release of Method from here. Extract the theme files into the extracted Method Generator's
build/directory. Make sure that you download the same version numbers of both projects. Otherwise, Method Generator may generate an unusable theme.
- First, install the project's dependencies by running the following command from method-generator's root folder:
npm install --save-dev
- Next, copy
njk/templates/_globals.html. This new file will be used when compiling a custom version of the base theme.
- Reconfigure the new
_globals.htmlfile to reflect your project (Globals reference).
- When you're ready to compile, from the method-generator's root folder run the following command:
gulp build-custom. This will copy the stock version of the theme into a new directory,
/custom, compile core theme files with the custom variavles you've set, and copy them over the stock files in
- To fully rebrand the theme, you'll need to replace 3 image files with your own:
/custom/screenshot.png: The screenshot displayed when choosing a theme from the Wordpress admin. The resolution of this image should be 1200px x 900px
/custom/assets/images/login-bg.jpg: The background image to use for the login page (only required if the custom_login_enable global variable was set to true )
/custom/assets/images/login-logo.png: The logo to use for the login page. Should be no wider than 250px (only required if the custom_login_enable global variable was set to true )
- Due to limitations with gulp, you'll need to recreate the
.gitignorefile for the new theme (while the gulp task can be reconfigured to duplicate dot files, it causes exclusions to be ignored, so this seems like the lesser of two evils). You can download Method's
.gitignorefile here, saving it to the
- That's it! You should have a custom theme ready to use for development! Duplicate and rename the
/customdirectory into the themes directory of your local WordPress installation and move on to installing Method's local dev dependencies to generate your new build's scripts and stylesheets.