feryardiant / wpdev

Personal WordPress boilerplate based-on Bedrock by Roots.
http://wpdev-demo.herokuapp.com/
MIT License
7 stars 5 forks source link
bedrock boilerplate composer heroku heroku-buildpack heroku-deployment heroku-ready wordpress wordpress-boilerplate wordpress-development workflow

My Personal WordPress Project Boilerplate Actions Status

This project aims to provide complete solution for WordPress development and deployment to heroku, even though it isn't completed just yet. 😬

Inspired by wordpress-heroku by Phillip Heuer and based on the exact same boilerplate of Bedrock, this project will give you better experiences while developing your very own WordPress themes and plugins that easily deployed to heroku.

Features

Requirements

Its always good to have WP-CLI installed globally on your system. For Database and HTTP Server requirements please refer to this documentation.

Installation

1. One-Click-Deployment

Deploy

Using this button you can deploy a new instance of WordPress. All required extensions will be deployed automatically. This also works if you fork your own project to work on your site.

2. Using composer create-project command

$ composer create-project feryardiant/wpdev [project-folder]

Create new database through PHPMyAdmin or from CLI

$ mysql -u[username] -p -e 'create database <database-name>'

Configure your .env file to suit your local setup, described here, also don't forget to set the url key on wp-cli.local.yml file as well. Once you're done, let's install WordPress core with the following command:

# Please consult to the official documentation for additional option you might needed for the setup
# See: https://developer.wordpress.org/cli/commands/core/install/
$ vendor/bin/wp core install

# Or you can simply run the following sortcut
$ composer wp:install

Please make sure to configure your HTTP server' document root to public directory.

Development

I using gulp for almost all development workflow in this project, not only for compiling scss files, minify images and compressing js, but also to run development server. Once you're done with installation process above, please install the development dependencies through yarn

$ yarn

To start the development server you can simply run command below:

# yarn global add glup-cli or npm -g install gulp-cli, in case you don't have one
$ gulp

The gulp default task will fire up PHP Developent Server, start BrowserSync on port 3000 and watch the changes you made. That way, all you need to do is open your web browser and type http://localhost:3000 on the address bar, open the project on your favorite code editor or IDE and start working.

All the changes you've made will be automatically linted and compiled, once it done BrowserSync will reload the browser for you.

Workflow

Since this project is based on Bedrock, the project directory structure is pretty much similar, but with some tweaks.

Directory Structure and Gulp tasks

β”œβ”€β”€ bin
β”œβ”€β”€ config
β”‚Β Β  β”œβ”€β”€ environments
β”‚Β Β  └── heroku
β”œβ”€β”€ public
β”‚Β Β  β”œβ”€β”€ app
β”‚Β Β  └── wp
β”œβ”€β”€ packages
β”œβ”€β”€ resources
└── tests
    β”œβ”€β”€ e2e
    β”œβ”€β”€ stubs
    └── unit

The gulp scripts will autoatically scan any sub-directories under plugins and themes and generate all the required gulp tasks if the sub-directory meets the following structures:

<dirname>
β”œβ”€β”€ assets
β”‚Β Β  β”œβ”€β”€ img
β”‚Β Β  β”œβ”€β”€ js
β”‚Β Β  └── scss
└── languages

Once you've create <dirname> above inside plugins or themes directory, you'll see similar gulp tasks as following:

$ gulp -T
β”œβ”€β”€ theme-plugin:php
β”œβ”€β”€ theme-plugin:zip
β”œβ”€β”¬ theme-plugin:build
β”‚ └─┬ <parallel>
β”‚Β Β  └── theme-plugin:php
β”œβ”€β”€ theme:php
β”œβ”€β”€ theme:img
β”œβ”€β”€ theme:css
β”œβ”€β”€ theme:js
β”œβ”€β”€ theme:zip
β”œβ”€β”¬ theme:build
β”‚ └─┬ <parallel>
β”‚Β Β  β”œβ”€β”€ theme:css
β”‚Β Β  β”œβ”€β”€ theme:img
β”‚Β Β  β”œβ”€β”€ theme:js
β”‚Β Β  └── theme:php
β”œβ”€β”€ theme-child:php
β”œβ”€β”€ theme-child:zip
β”œβ”€β”¬ theme-child:build
β”‚ └─┬ <parallel>
β”‚Β Β  └── theme-child:php
β”œβ”€β”¬ zip
β”‚ └─┬ <series>
β”‚Β Β  β”œβ”€β”€ theme-plugin:zip
β”‚Β Β  β”œβ”€β”€ theme:zip
β”‚Β Β  └── theme-child:zip
β”œβ”€β”¬ build
β”‚ └─┬ <parallel>
β”‚Β Β  β”œβ”€β”€ theme-child:php
β”‚Β Β  β”œβ”€β”€ theme-plugin:php
β”‚Β Β  β”œβ”€β”€ theme:css
β”‚Β Β  β”œβ”€β”€ theme:img
β”‚Β Β  β”œβ”€β”€ theme:js
β”‚Β Β  └── theme:php
β”œβ”€β”€ e2e
β”œβ”€β”€ release
└── default

Notes

Sponsors

Credits

License

(c) 2019 Fery Wardiyanto - MIT license.