A progressive theme development rig for WordPress.
A progressive theme development rig for WordPress, WP Rig is built to promote the latest best practices for progressive
web content and optimization. Creating a theme from WP Rig means adopting this approach and the core principles it is
built on:
We are trying to be the starter theme for design-focused devs. If you have any ideas, questions, or suggestions for this
project or are seeking to get involved in contributing or maintaining, please check out
our discussion board on Github and
read our contribute page on our website.
We have a new Documentation area that can be found on the WP Rig website.
If you would like to contribute to our documentation efforts, please submit a request on
our contribute page on our website.
WP Rig has been tested on Linux, Mac, and Windows.
WP Rig requires the following dependencies. Full installation instructions are provided at their respective websites.
WP Rig is built to lay a solid theme foundation, which is excellent for a parent theme but not for a child theme. A
child theme is meant to only add on or modify the foundation. As such, WP Rig is not intended for making child themes to
extend any themes, whether they were originally built with WP Rig or not.
wprig
or wprig-themeslug
. For instance, if your theme will eventually be named “Excalibur” yourwprig-excalibur
. The excalibur
directory will be automatically created./config/config.default.json
for the default settings../config/config.json
to override default settings../config/config.local.json
, e.g. potentially sensitive info like the path tonpm run rig-init
to install necessary node and Composer dependencies.npm run dev
to process source files, build the development theme, and watch files fornpm run build
can be used to process the source files and build the development theme without watching filesHere is an example of creating a custom theme config file for the project. In this example, we want a custom slug, name,
and author.
Place the following in your ./config/config.json
file. This config will be versioned in your repo, so all developers
use the same settings.
{
"theme": {
"slug": "newthemeslug",
"name": "New Theme Name",
"author": "Name of the theme author"
}
}
Some theme settings should only be set for your local environment. For example, if you want to set local information for
BrowserSync.
Place the following in your ./config/config.local.json
file. This config will not be tracked in your repo and will
only be executed in your local development environment.
{
"browserSync": {
"live": true,
"proxyURL": "localwprigenv.test",
"https": true,
"keyPath": "/path/to/my/browsersync/key",
"certPath": "/path/to/my/browsersync/certificate"
}
}
If your local environment uses a specific port number, for example, 8888
, add it to the proxyURL
setting as follows:
"proxyURL": "localwprigenv.test:8888"
npm run bundle
from inside the wp-rig
development theme.wp-content/themes
.To take full advantage of the features in WP Rig, visit
the Recommended code editor extensions Wiki page.
WP Rig can be used in any development environment. It does not require any specific platform or server setup. It also
does not have an opinion about what local or virtual server solution the developer uses.
Before the first run, visit the BrowserSync wiki page.
dev watch
processnpm run dev
will run the default development task that processes source files. While this process is running, source
files will be watched for changes, and the BrowserSync server will run. This process is optimized for speed, so you can
iterate quickly.
dev build
processnpm run build
processes source files one-time. It does not watch for changes nor start the BrowserSync server.
translate
processThe translation process generates a .pot
file for the theme in the ./languages/
directory.
The translation process will run automatically during production builds unless the export:generatePotFile
configuration value in ./config/config.json
is set to false
.
The translation process can also be run manually with npm run translate
. However, unless NODE_ENV
is defined
as production
, the .pot
file will be generated against the source files, not the production files.
production bundle
processnpm run bundle
generates a production-ready theme as a new theme directory and, optionally, a .zip
archive. This
builds all source files, optimizes the built files for production, does a string replacement and runs translations.
Non-essential files from the wp-rig
development theme are not copied to the production theme.
To bundle the theme without creating a zip archive, define the export:compress
setting in ./config/config.json
to false
:
export:
{
compress: false
}
WP Rig uses a fast end efficient build process to generate and optimize the code
for the theme. Gulp 5, Lightning CSS, and esbuid are mainly used to provide the underlying functionality.
All development is done in the wp-rig
development theme. Feel free to edit any .php
files.
You should only edit the source asset files in the following
locations:
assets/css/src
(Processed by Lightning CSS)assets/js/src
(Processed by esbuild)assets/images/src
(Processed by Gulp)For more information about the Gulp processes, what processes are available, and how to run them individually, visit
the Gulp Wiki page.
As WP Rig processes CSS and JavaScript, it will support the browsers listed in .browserslistrc
. Note that WP Rig will
not add polyfills for missing browser support. WP Rig will add CSS prefixes and transpile JavaScript.
WP Rig gives the developer an out of the box environment with support for modern technologies, including ES2015, CSS
grid, CSS custom properties (variables), CSS nesting and more, without making any configurations. Just write code, and
WP Rig handles the heavy lifting for you.
Configuring the behavior of WP Rig is done by editing ./config/config.json
. Here the developer can set the theme name
and theme author name (for translation files) and local server settings for BrowserSync. Additionally, compression of
JavaScript and CSS files can be turned off for debugging purposes.
Place your custom theme settings in ./config/config.json
to override default settings, located
in ./config/config.default.json
. Place local-only/untracked theme settings in ./config/config.local.json
. For
example, if you want to set local information for BrowserSync.
WP Rig ships with advanced features, including:
For more information about the advanced features in WP Rig and how to use them, visit
the Advanced Features Wiki page).
WP Rig is released
under GNU General Public License v3.0 (or later).