Lesson 2

Establishing a Professional Development Environment

Tools

  • Git
  • Vagrant
  • JSON
  • Composer
  • NPM
  • Gulp
  • WP-CLI
  • _s

Git

Git is not something you learn in a day.
Git is something you learn over the course of your career.

Git

  • Come on, it's 2015!
  • Revision control is a must in modern development.
  • Alternatives: Subversion, Mercurial, ???
  • Meh, just use Git

Git Repository Services

Vagrant

Virtualized development environment…

…a computer inside a computer.

Why use Vagrant?

  • Can be configured with code.
  • Allows for closer match with the production environment.
  • Environments can be created and destroyed at will:

You can vagrant destroy,
but you can never vagrant forget.

JSON

File format often used for configurations.

{
  "name": "rp3agency-website",
  "title": "RP3 Agency Website",
  "url": "https://rp3agency.com",
  "contributors": [
    {
      "name": "Tracy Rotton",
      "email": "trotton@rp3agency.com"
    },
    {
      "name": "Kurt Roberts",
      "email": "kroberts@rp3agency.com"
    }
  ]
}

package.json

Package Managers

Package Managers

Automates the process of installing, updating, and removing software.

Retrieves code from a central repository.

Composer

  • Package manager for PHP
  • Can be used to manage WordPress core and plugins

NPM

  • Node Package Manager
  • Means to an end

Gulp.js

  • JavaScript task runner
  • Used to convert Sass to CSS…
  • …and a whole lot more

WP-CLI

  • Provides a command-line alternative to managing WordPress
  • Faster than /wp-admin/
  • Scripting!

_s

  • Pronounced "underscores"
  • "Starter" theme
  • Provides base templates, functions, and classes upon which to build a custom theme.

Essential Development Plugins

Show Template

Very simple plugin for showing you which template file WordPress is using to generate the page you're on.

Debug Bar

Installs a "Debug" section in your admin bar with diagnostic information.

Theme Check

Makes sure your theme meets the standards required to be added to the WordPress theme repository. Makes sure your using WordPress best practices in building your theme.

Regenerate Thumbnails

Especially useful when working with responsive images, takes the images in your media library and creates different sized versions of them.

WP Migrate DB (Pro)

Exports your database as a MySQL data dump, does a find and replace on URLs and file paths, then allows you to save it to your computer.

WordPress Importer

Allows you to import an XML file, such as the Theme Unit Test data.

Installing Your WordPress Environment

Download Prerequisites

 

Bonus for Windows Users

Get the Archive

git clone https://github.com/taupecat/VVV.git

Vagrant Up!

cd VVV
vagrant up

SSH

vagrant ssh

Install Composer Packages (Plugins)

cd /vagrant
composer install

Install Node Modules

npm install

Activate Our Plugins

cd www/wordpress-default
wp plugin activate --all

Install Our Starter Theme

wp scaffold _s [theme-slug] \
--theme_name="[Theme Name]" --sassify

Activate Our Theme

wp theme activate [theme-name]

Import Theme Unit Test

wp import ../../theme-unit-test-data.xml --authors=skip

Customize wp-config.php