wp-get-go (get-go = get going) is a framework for bootstrapping WordPress theme/plugin development.
Note: Right now only focused on client-facing WordPress theme projects and component (module) architecture (because theme components are easier to conceptualise). Plugins are the aim of version 2.0.0.
While developing a new custom theme, a developer usually
- Downloads a starter theme.
- Performs a find/replace for
theme-slugand manually edits the theme header information instyle.scssorstyle.css. - Creates or copies additional files:
.js,.scss,.phptemplate files, (for eg.event-single.php) to achieve the desired look and feel - Creates additional code in
functions.phprequired to achieve the desired functionality (for eg, enqueueing scripts and styles)
A lot of these additional work can be repetitive and often follow patterns. It often takes hours to finally get all the basic repetitive stuff in place before the developer can start working on code that they are writing for the first time. Such additional code can be separated and arranged as reusable modules or components.
- High level
slideshow,testimonial,staff-profile,related-posts,gallery,portfolio,call-to-action, etc - Low level
section-with-aside,hero,hero-with-cta,section-with-image,section-with-round-image,section-with-square-image,hero-with-quote, etc - Libraries/ Frameworks
font-awesome,masonry,infinite-scroll, a post meta framework like ButterBean, etc
This framework is an attempt to automate and modularise development of custom themes (and plugins) so that the developer can quickly start writing the actual custom part of the code instead of spending hours just getting things in place.
git*gruntsass
- No longer involves grunt since bootstrapping is a one time task. It makes more sense to take it out of the repetitive workflow and task management. This also separates it from the
gruntvsgulpor any other workflow, now or in the future.
GitLab or BitBucket git server for repositories involved (because they support git archive command, GitHub workaround is for later; we wish to avoid git clone or downloading a .zip of the whole repo because it's too much unnecessary data).
- A
gruntnode plugin - A starter theme/plugin repository.
- A component (reusable code modules) repository
When starting a new custom theme, a developer will
- install wpBootStrap's node plugin
- create a new folder for the theme.
- create (or clone or copy and modify) a
package.jsonin this folder (see example below) that describes the starter theme and the components needed for this theme. - install wpBootStrap's node plugin
- create (or clone or copy and modify) a
Gruntfile.jsand with abootstraptask for the grunt plugin in 2. - run
wpbootstrapcommand - start writing code.
{
"name": "my-project-name",
"version": "0.0.1",
"author": {
"name": "Yapapaya",
"url": "https://yapapaya.com"
},
"homepage": "https://yapapaya.com/my-project-name/",
"description": "A custom description for My Project Name",
"repository": "[email protected]:yapapaya/my-project-name.git",
"bugs": "https://git.yapapaya.in:yapapaya/my-project-name/issues/",
"wpBootStrap": {
"prettyName": "My Project Name",
"starter": {
"repository": "[email protected]:yapapaya/yapapaya_s.git",
"replace": "_s"
},
"components": {
"names": [ "flex-grid", "font-awesome", "testimonial", "section-with-aside" ],
"repository": "[email protected]:yapapaya/theme-components.git",
"replace": "component"
}
}
}These can be generated using the package name
"name": "my-project-name"This part of the package.json can be used to generate the theme headers.
{
"name": "my-project-name",
"version": "0.0.1",
"author": {
"name": "Yapapaya",
"url": "https://yapapaya.com/"
},
"homepage": "https://yapapaya.com/my-project-name/",
"description": "A custom description for My Project Name",
"repository": "[email protected]:yapapaya/my-project-name.git"
}The json above will create the theme headers in style.css as follows:
<?php
/*
Theme Name: My Project Name
Theme URI: https://yapapaya.com/my-project-name/
Author: Yapapaya
Author URI: https://yapapaya.com/
Description: A custom description for My Project Name
Version: 0.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: my-project-name
*/This part contains information that the wpBootStrap framework needs.
{
"wpBootStrap": {
"name": "My Project Name",
"starter": {
"repository": "[email protected]:yapapaya/yapapaya_s.git",
"replace": "_s"
},
"components": {
"names": [ "flex-grid", "font-awesome", "testimonial", "section-with-aside" ],
"repository": "[email protected]:yapapaya/theme-components.git",
"replace": "component"
}
}
}
This is an example of an internal version we are working on.
- name: (optional) can be used for
Theme Name:header. - starter: (required) contains information about the starter theme/framework
- repository: (required) is the
giturl of the repository of the starter (only BitBucket and GitLab supported, as of now) - replace: (optional) is the namespace of the starter. This will be replaced with variations of the package name See the idea behind it, using _s theme.
- components: (optional) contains information about the components
- names (optional) is an array of components that are needed for this theme.
- repository (required) the repository where the archive containing all the components is.
- replace (optional) a common namespace used by all the components for function prefixes, etc, just like the
replacefield ofstarter.