Ship & extend
Patterns
Pieces of a page you keep: saving a section, inserting it in any project, folders, the class check, and a library on GitHub.
A pattern is a piece of a page you keep: a section, several elements side by side, a component instance, anything you can select in the tree. Inserting one leaves ordinary elements with no link back. Editing what you inserted never changes the pattern, and editing the pattern never changes a page. Where a component is one definition with live instances, a pattern is a starting point you own.
Saving one
Right-click a layer and choose Save as pattern…. With several layers selected they are saved as one. Name it, give it a category such as Header, Hero or Features, or a word of your own, and choose where it goes: This project or your Library.
- A pattern takes along what a copy takes: its elements, the rules about them from your own stylesheets, the components and pop-ups it uses, and the variables its CSS reads. Design-system rules stay behind, since every project has them.
- A library pattern also keeps copies of its pictures, so it inserts on a computer that never had the project.
Inserting one
+ → Patterns… or ⇧⌘E opens the library: This project and Library in the rail with their folders, search and the category filter in the toolbar. A click on a card inserts it at the selection.
- Folders are yours: make, rename and delete them, and drop a card on one to file it there. A pattern in a folder you delete stays, unfiled.
- Categories say what a pattern is, and filter the list.
Classes on the way in
A pattern wears class names, and the project you insert into may have rules under the same names. Each class the project already has is checked before the pattern lands, grouped by its BEM block: hero, hero__title and hero--dark are one block and are renamed together, with their rules and everything that points at them.
- Rename to gives the block a free name,
hero-2or one you type. Keep lets the pattern wear this project’s class and its look. A block whose rules are the same here starts on Keep. - Don’t ask again switches the check off, and the library’s settings say what happens then: rename every clash, or keep it.
- Insert as… opens the same check for every block of the pattern, to name it on the way in. An element with no class of its own can be given BEM names there.
- Design-system classes such as
btn--primaryare never renamed: they are meant to be shared.
Where they live
| Where | Travels with | |
|---|---|---|
| This project | site.sitereal | The project’s own git. |
| Library | The app’s folder on this computer | Its own GitHub repository, if you connect one. |
A project that holds patterns of its own is opened read-only by a sitereal older than 1.1, which would otherwise save it without them.
A library on GitHub
The library can be a repository of its own, through the same GitHub sign-in the History’s Git tab uses. Connect makes a new private repository, or takes an existing one, which is how a second computer joins. Upload sends your patterns and takes what is there, and Import takes what is there. Where both changed the same pattern, the one on GitHub stands. Project patterns need none of this: the project’s git carries them.