Superbia's WordPress starter project.
- Better folder structure
- Dependency management with Composer
- Environment specific WordPress configuration
- WordPress Extra coding standards with WP Enforcer
- Browser targeting with Browserslist
Clone this repo and then run the following command to create your new project:
$ ./bin/bootstrap
You will be prompted for the following information:
- Theme name [My Awesome Theme]
- Domain name [awesome.com]
- If you'd like to remove the bootstrap git repo and init a new one"
The bootstrap script will then take care of all the steps under Manual Installation
The first thing you need to do is renmae the _s theme directory, changing it to something else (like, say, my-awesome-theme), and then you'll need to do a five-step find and replace on the name in all of the templates.
- Search for: '_s' and replace with: 'my-awesome-theme'
- Search for: s and replace with: my_awesome_theme_
- Search for: Text Domain: _s and replace with: Text Domain: my-awesome-theme in style.css.
- Search for: _s and replace with: My_Awesome_Theme
- Search for: _s- and replace with: my-awesome-theme-
Then, update the stylesheet header in style.css
Install dependencies with Composer:
$ composer install
Copy the config.sample.php
file, replacing sample
with your environment: dev
, staging
or production
.
WP Enforcer uses Git Hooks to automatically run PHP_CodeSniffer every time a developer tries to make a commit. If the code doesn't conform to the WordPress VIP coding standards, the commit will be rejected and the developer will get a message explaining what needs to be fixed.
Run the WP Enforcer installation script to copy the Git hooks into your local repository:
$ ./vendor/bin/wp-enforcer
cd public/app/theme/neoskosmos
.yarn
to install required dependencies.gulp
to run all the tasks required to build the theme.gulp watch
to watch for changes and automatically run tasks.- Visit
http://localhost:3000
to view live-reloaded changes via Browsersync. yarn run gulp-build
to build the theme's assets for production.
If your commit is rejected, you can run PHP_CodeSniffer manually while working through any issues:
$ ./vendor/bin/phpcs
Browserslist allows you to set target browsers to support in your package.json file and share the config with tools like Autoprefixer and Babel. Unfortunately it isn't supported in version 6 of Babel.
WordPress Bootstrap currently uses the following config:
"browserslist": [
"> 0.5%",
"last 2 version",
"not dead",
"IE 10"
]
Browserslist has some helpful commands that you can use to see what browsers are being supported by your config.
List Browsers
$ yarn run browserslist
List coverage
$ yarn run browserslist --coverage
Thanks to the following projects/people that have influenced our WordPress Bootstrap
- Roots Bedrock for folder structure and composer setup
- Rarst for his Guide to Composer in WordPress
- Underscores for their theme renaming strategy
- Focus Lab's EE Master Config and Ashfame's awesome-wp-config-file.php