Pattern primer

I’m on a workshopping roll. Fresh from running my Responsive Enhancement workshop in Belfast, I’m now heading to Düsseldorf for Beyond Tellerand where I’ll be running the workshop on Sunday (and if you can’t make it, don’t forget that you can book the workshop for your own workplace too).

As part of the process of building a responsive site from the content out rather than the canvas in, I talk about beginning with the individual components divorced from any layout context. Or, as Mark puts it, “start with the bits.”

That’s the way I’ve been starting most of my projects lately: beginning with the atomic units of content and styling them first before even thinking about layout. This ensures that those styles are extremely robust—because they don’t depend on any particular context, they can be safely dropped into any part of a page.

I’ve been calling this initial collection of markup snippets a pattern primer. To help create the pattern primer, I’ve written a little bit of PHP to automatically generate a page of patterns from a folder of HTML snippets.

In my workshop I keep promising to put that script on Github. I finally got around to doing that and you can find it at github.com/adactio/Pattern-Primer.

Take a look at an example pattern primer to get an idea of what a handy deliverable this can be if you’re handing off to other developers. It also acts like a page of unit tests for CSS—whenever you’ve been messing around in the stylesheet you can refresh the page to quickly check to see if anything looks screwed up.

Grab the code; improve upon it; share your changes.

Have you published a response to this? :

Responses

adactio.com

I’m on a workshopping roll. Fresh from running my Responsive Enhancement workshop in Belfast, I’m now heading to Düsseldorf for Beyond Tellerand where I’ll be running the workshop on Sunday (and if you can’t make it, don’t forget that you can book the workshop for your own workplace too).

As part of the process of building a responsive site from the content out rather than the canvas in, I talk about beginning with the individual components divorced from any layout context. Or, as Mark puts it, “start with the bits.”

That’s the way I’ve been starting most of my projects lately: beginning with the atomic units of content and styling them first before even thinking about layout. This ensures that those styles are extremely robust—because they don’t depend on any particular context, they can be safely dropped into any part of a page.

I’ve been calling this initial collection of markup snippets a pattern primer. To help create the pattern primer, I’ve written a little bit of PHP to automatically generate a page of patterns from a folder of HTML snippets.

In my workshop I keep promising to put that script on Github. I finally got around to doing that and you can find it at github.com/adactio/Pattern-Primer.

Take a look at an example pattern primer to get an idea of what a handy deliverable this can be if you’re handing off to other developers. It also acts like a page of unit tests for CSS—whenever you’ve been messing around in the stylesheet you can refresh the page to quickly check to see if anything looks screwed up.

Grab the code; improve upon it; share your changes.

# Saturday, November 19th, 2011 at 12:26pm

Hidde de Vries (@hdv@front-end.social) is a web enthusiast and accessibility specialist from Rotterdam (The Netherlands). He currently works on web standards for the Dutch government and is a participant in the Open UI Community Group. Previously, he work

I just read Anna Debenham’s pocket guide to front-end styleguides. With only 69 pages, it is a concise guide to what (front-end) style guides are and how to use them.

It explains what style guides are (used) for, goes into different kinds of style guides used specifically on the web, describes what elements a web style guide can consist of, considers some of the main benefits of style guides on the web, gives some examples of good web style guides and finally looks into what the future for style guides might be.

Anna describes many different types of style guides for the web, such as style tiles, pattern portfolio’s and pattern primers. The main idea with all of those is that they come into being before page lay-out. They describe visual styles of page components, from which full pages can be construed later on in the design process.

The cover of Anna’s Pocket Guide

Style guides for better front-ends

Style guides can be very helpful for those pursuing to build better front-ends (and who isn’t?).

  • You don’t know which HTML the CMS or future versions of the CMS will spit out, and even if you do, the designer might not have styled them. If you include all generally used HTML in your style guide, you can make sure all of those are properly styled and tested across different platforms and devices.
  • Creating a front-end style guide will help find inconsistencies between components’ designs, and therefore help avoid inconsistencies in the underlying CSS.
  • Making a front-end style guide helps thinking even more component-like, which according to some is good. Components are not tied to a specific space in a page layout. That is helpful as much of today’s web design is for multiple screens.
  • The style guide can be used to show all involved in the project what kinds of content (can) exist in their website.

I have used simple style guide and pattern primers in projects before, and plan to do even more so after reading Anna’s short book.

,

Related posts

Command and control

HTML’s new `command` attribute on the `button` element could be a game-changer.

A polyfill for button type=”share”

Kicking the tyres on a declarative Web Share API.

Components and concerns

Gotta keep ‘em separated.

Code refactoring for America

Committing CSS heresy for more maintainable markup.

Months and years

Progressively enhancing form fields.

Related links

HTML Over The Wire | Hotwire

This is great! The folks at Basecamp are releasing the front-end frameworks they use to build Hey. There’s Turbo—the successor to Turbolinks:

It offers a simpler alternative to the prevailing client-side frameworks which put all the logic in the front-end and confine the server side of your app to being little more than a JSON API.

With Turbo, you let the server deliver HTML directly, which means all the logic for checking permissions, interacting directly with your domain model, and everything else that goes into programming an application can happen more or less exclusively within your favorite programming language. You’re no longer mirroring logic on both sides of a JSON divide. All the logic lives on the server, and the browser deals just with the final HTML.

Yes, this is basically Hijax (which is itself simply a name for progressive enhancement applied to Ajax) and I’m totally fine with that. I don’t care what it’s called when the end result is faster, more resilient websites.

Compare and contrast the simplicity of the Hotwire/Turbo approach to the knots that React is tying itself up in to try to get the same performance benefits.

Tagged with

Offline listings

This is brilliant technique by Remy!

If you’ve got a custom offline page that lists previously-visited pages (like I do on my site), you don’t have to choose between localStorage or IndexedDB—you can read the metadata straight from the HTML of the cached pages instead!

This seems forehead-smackingly obvious in hindsight. I’m totally stealing this.

Tagged with

A progressive disclosure component - Andy Bell

This is a really nice write-up of creating an accessible progressive disclosure widget (a show/hide toggle).

Where it gets really interesting is when Andy shows how it could all be encapsulated into a web component with a progressive enhancement mindset

Tagged with

github/details-menu-element

Now this is how you design a web component! A great example of progressive enhancement by Mu-An Chiou that’s used all over Github: a details element that gets turbo-charged into a details-menu.

There’s also a slidedeck explaining the whole thing.

Tagged with

The power of progressive enhancement

Andy’s slides:

We dive into why progressive enhancement is important and how we can leverage the power of Vanilla JavaScript, Web Components and modern CSS to deliver a hack-free, lightweight and progressive experience for our users.

Tagged with

Previously on this day

15 years ago I wrote Spacelift

My project at Science Hack Day San Francisco

19 years ago I wrote To Cape Canaveral… and beyond!

I went behind the curtain at the Kennedy Space Center.

19 years ago I wrote Refreshed

Wrapping up Refresh Orlando 2006.

21 years ago I wrote Mac madness

I was thinking of heading up to the Mac Expo in London tomorrow. It’s pretty much an annual event for me (anyone remember this post from three years ago?).

24 years ago I wrote Photoshop: It's All the Rage

This article at Wired is all about Photoshop. Specifically, it’s all about the popularity of "Photoshopping" images for fun, satire or spite.