Glyph – Defining Custom Commands and Tasks

In most cases, you can extend Glyph just by creating your own custom macros. In some cases though, you may want to further customize Glyph to fit the needs of your project, in terms of creating custom commands and custom tasks.

Glyph’s modular architecture (and the Ruby language itself) lets you to add arbitrary functionality to its core, simply by creating a few Ruby files and putting them in the right places.

How Commands and Tasks work

Before creating custom Glyph commands and tasks, you should have a basic understanding on how they work, and which commands — or better, which tasks — are already available.

The following diagram outlines the relationships between the default commands and some tasks:

Some of Glyph default commands and tasks

As you can see:

  • All commands call at at least one task.
  • There are several task inter-dependencies spanning across three main Rake namespaces:
    • project: — used for tasks affecting only the physical structure of the Glyph project.
    • load: — used to load all kinds of files.
    • generate: — used to generate files or copy files from source to output directories