Experimenting with Pattern Libraries

I’ve been experimenting with pattern libraries lately. They’re useful to have so developers can put things together quickly without reinventing the wheel (I once provided a pattern library for a team that had reimplemented some of their basic design patterns at least 6 different ways before I helped them unify everything) and they help the design team think about things consistently and meaningfully (having to add another pattern to the library makes you start questioning why this particular region needs a different style). But they can be awkward to put together and difficult to make sure all of the design changes continue to be added over time–and once they’re out of date, they’re worse than useless.

I’ve recently discovered Pattern Lab, which produces a pretty nice basic pattern library off of a bunch of templates, and that solves the first problem, but the problem of maintaining it over time remains. In fact, the problem could even be worse–with something entirely custom, you might be able to build it off of the same template system that’s used in the real site, so there only needs to be a change in one place, but with the generator you’re almost certainly using a separate code base, so all changes need to be made twice.

So I’ve been playing with making a conversion script that takes the patterns from Pattern Lab and converts it for a couple of different content management systems I use. So far I have it working for Django, Jekyll, and Statamic; I have tried but failed to get it working in Perch and Drupal because some of the things that need to be done in those environments is difficult to automate based on the Mustache templates that Pattern Lab uses.

The code for the script is on Github, and I’d be delighted if you used it on your own projects, forked it, modified it, added more output CMSs, etc. if it is a thing you would find useful. I hope it’s well enough documented to get started, but if you have questions, please ask :)