WordPress Theme Starter Kit is an opinionated build automation for front-end web development based on Gulp, Node, NPM, Bower, Babel, and Sass.
Note: WordPress Theme Starter Kit is simply a guideline and it doesn't solve everything. It is up to you to modify whatever necessary to achieve your project goals.
- Dependencies
- WordPress
- Meta Information
- Default Task
- Build Task
- Server Task
- Assets Task
- Data
- Fonts
- Images
- Media
- Miscellaneous
- Meta
- Vendors
- Scripts Task
- Styles Task
- Structure
- Views Task
Run: npm cache clear && npm i && bower cache clean && bower install
Note: Before you can install WordPress Theme Starter Kit dependencies, you will need to install Gulp, Node, NPM, and Bower.
You have to install WordPress inside ./build
directory and create a local MySQL database.
Open ./package.json
file and set your project details (name
, description
, version
, author
, etc.). This information will be used to set your theme directory and CSS/JS headers.
Run build
and server
tasks.
Run: gulp
Generate a fresh build of your project. Task will run several individual tasks on files within ./src
and then output them to ./build/wp-content/themes/{custom-name}/
.
Run: gulp build
Start a local dev server. Mamp URL must match proxy in ./gulpfile.babel.js
. By default it's set to http://localhost:8888/
. Also, Mamp needs to point to ./build
directory (WordPress root). For more information about BrowserSync go to http://www.browsersync.io/.
Run: gulp server
Run several individual tasks to copy static files from ./src
to ./build/wp-content/themes/{custom-name}/
.
Run: gulp assets
Copy data files to ./build/wp-content/themes/{custom-name}/data
.
Run: gulp data
Copy font files to ./build/wp-content/themes/{custom-name}/fonts
.
Run: gulp fonts
Copy images to ./build/wp-content/themes/{custom-name}/images
. As a personal preference WordPress Theme Starter Kit doesn't use automated image optimization. It is strongly recommended to use services like TinyPNG and TinyJPG to optimize images manually.
Run: gulp images
Copy media files to ./build/wp-content/themes/{custom-name}/media
.
Run: gulp media
Copy miscellaneous WordPress files, such as style.css
or screenshot.png
, to the root of ./build/wp-content/themes/{custom-name}
.
Run: gulp misc
Add meta information to default style.css
. You can set meta information in ./package.json
file.
Run: gulp meta
Bundle vendor files to ./build/wp-content/themes/{custom-name}/vendors
. You can install new client-side vendors using Bower, then reference appropriate files in ./src/vendors/bundle.js
and ./src/vendors/bundle.min.js
. WordPress Theme Starter Kit comes with jQuery example.
Run: gulp vendors
Run a series of sub-tasks to generate final JavaScript files. See ./gulpfile.babel.js
for reference.
Note: Each file on the root of ./src/scripts
will be compiled to its own file in ./build/wp-content/themes/{custom-name}/scripts
. Each file can have own includes, just like Sass with @import
functionality. See ./src/scripts/main.js
as an example.
Run: gulp scripts
Run a series of sub-tasks to generate final CSS files. See ./gulpfile.babel.js
for reference.
Note: Each file on the root of ./src/styles
will be compiled to its own file in ./build/wp-content/themes/{custom-name}/styles
.
Run: gulp styles
WordPress Theme Starter Kit follows a strict naming convention using BEM methodology.
Directory structure and selector names are divided into namespaces based on More Transparent UI Code with Namespaces article by Harry Roberts.
Copy PHP files to ./build/wp-content/themes/{custom-name}
Run: gulp views