Created: 2011-07-14 01:26
Updated: 2016-09-12 15:26


You can put lipstick on a pig, but it's still a pig.

(pig: WordPress, lipstick: Starter themes)

We created Rye because there are times when we need to build high performing applications with a WordPress backend. When we do this, we don't want several layers of abstraction existing simply to help the majority of developers.

What Rye does:

  1. Isolates the boilerplate code you need to write to one place.
  2. Gives you a simple and modern/psr-4-ready file architecture to start with.

What Rye does not:

  • Try to make you buy stuff.
  • Add too many layers of abstraction.
  • Add dependencies (except for composer - which you can strip if you want).
  • Override default WP conventions. WP methods will always remain true.

Getting started.

Please make sure you have npm and gulp installed globally.

  1. Download and add this project as a theme in your WP installation. Rename the directory to something relevant.
  2. npm install and composer install so the gulp plugins will be installed.
  3. Edit the package.json file. The project name will be used to set the name for the compiled asset files.
  4. Configure the configuration array in init.php.
  5. Add custom theme-specifc logic to lib/Rye/Grain.php.
  6. Add any other classes and namespaces to this directory.
  7. Develop your styles using gulp watch.

Running gulp at any time will build your assets. For convience, run gulp watch and your files will be compiled automatically as you edit them.

Rye globals.

  • Rye The Rye class. Not much to do here. It's the "core".
  • Grain A good place to add helper/utility methods. Can be later accessed like Rye\Rye::$grain->myMethod().
  • Rye::$grain The Grain singleton reference. This gets instantiated in Rye's init.
  • Rye::package() The package.json file as a php object.
  • Rye::projectName() Returns sanitized name specified in the package.json file.
  • Rye::$enviornment A static property which tells Rye which enviornment to run in. This is in the functions.php file for you. It can be assigned to 1 of 4 constants; Rye::TESTING, Rye::DEVELOPMENT, Rye::STAGING, or Rye::PRODUCTION.
  • Rye::stylesheet() Outputs style tags using the appropriate css file based on the enviornment property.

Project architecture.

  • lib/ Put any other custom classes you may need and configure the init.php file.
  • templates/ A place to put partials and custom templates.
  • style.css This shouldn't be used. It's only required to specify information about the theme for WordPress.
  • assets/css Any css or pre-processor css file such as .styl or .less files should be included here. The main entry file should be called app.(type).
  • assets/js App specific JavaScripts should be added here. After Grunting thing will compiled into assets/dist.
  • assets/js/vendor These files don't get compiled/minified after gulping. They should be specified in the functions.php file (in the Rye config array) so WordPress is aware of them. This will eliminate any chance of duplicate libraries being added after installing plugins.

Plugin recommendations for doing things.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more