Skip to content

Website content builds

ronchalant edited this page Oct 16, 2012 · 5 revisions

Overview

Each sub-site and its contents are stored in a github repository under https://github.com/jquery/. For example, navigating to https://github.com/jquery/api.jquery.com will show the contents of the api.jquery.com site.

Scott Gonzalez's (https://github.com/scottgonzalez) grunt-jquery-content plugin translates the contents from the various website repositories into WordPress posts/page files into the dist/wordpress directory, then deploys these to your local/development WordPress instance using grunt-wordpress using the config.json file located in the local repository directory.

Dependencies

Many of the grunt builds for the website content projects require xmllint and xsltproc to be installed. If you are on a Mac you likely have these installed (simply run xmllint and xsltproc from the terminal to determine).

If you're on a Windows machine you may need to download and install xmllint and xsltproc which are in libxml2 and libxslt here: http://sourceforge.net/projects/gnuwin32/files/

Additionally, this guide assumes that grunt & npm are installed and configured.

Step-by-Step

Individual site content repos shouldn't be pulled directly into the DocumentRoot path. The content should be cloned from github to a separate directory path, where it will be build and pushed to the local jQuery WordPress webserver using grunt.

For the purposes of this guide, suppose our working directories are:

  • Apache configured with DocumentRoot pointing to /Users/{username}/projects/jQuery/webroot/ (meaning the ~/projects/jQuery/webroot directory contains web-base-template, wp-admin, etc.)
  • Working site folders are stored under /Users/{username}/projects/jQuery/sites

If you intend to make changes, fork the website content repo that you want to publish locally then clone it to a build outside of your *.jquery.com WordPress environment. For this guide we'll be using the /jquery/api.jquery.com site as a sample.

cd to 'sites' directory:

cd ~/projects/jQuery/sites

Clone your forked repo (or if you just want to build content locally you can clone the upstream): git clone https://github.com/{ghname}/api.jquery.com

Add remote upstream/etc. as normal (https://help.github.com/articles/fork-a-repo)

cd to the directory:

cd api.jquery.com

Install dependencies:

npm install

Wait while dependencies download......

Copy the config-sample.json to config.json:

cp config-sample.json config.json OR copy config-sample.json config.json

Open that file in whatever text editor you prefer, and change the username & password entries to match the admin login/password of your local WordPress instance. Complete config.json explanation is here: https://github.com/scottgonzalez/grunt-wordpress#config

Note: when originally committed the config-sample.json files used "dev." as a prefix; later configurations are now using "local." (e.g. "local.api.jquery.com") which are resolved by jQuery's DNS servers. This simplifies configuration so that you don't need to add entries to your /etc/hosts or C:\Windows\system32\drivers\etc\hosts file. You may need to also adjust the url in the config.json depending on how you've configured your environment, but this url should always be prefixed with "dev." or "local."

Issue the 'grunt deploy' command:

grunt deploy

Possible issues:

Error publishing {somefile.ext} Error: XML-RPC fault: Unable to create directory {DocumentRoot}/web-base-templates/blogs.dir/...

For grunt-wordpress to function properly, the plugin needs to be able to write to {DocumentRoot}/web-base-template/ - you may have to adjust permissions to ensure this.

Clone this wiki locally