|
| 1 | +# SUIT utilities |
| 2 | + |
| 3 | +A SUIT collection of utility classes for common, reusable, low-level CSS traits. |
| 4 | +The collection includes text, link, display, layout, space, and state utilities. |
| 5 | + |
| 6 | +Read more about [SUIT's design principles](https://github.com/necolas/suit/). |
| 7 | + |
| 8 | +## Installation |
| 9 | + |
| 10 | +* Download: [zip](https://github.com/necolas/suit-utils/zipball/master) |
| 11 | +* [Bower](https://github.com/twitter/bower/): `bower install suit-utils` |
| 12 | +* Git: `git clone https://github.com/necolas/suit-utils.git` |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +### Referencing |
| 17 | + |
| 18 | +During development, you can include the utilities you need using the `@import` |
| 19 | +directive in your main stylesheet. Your build step should take care of inlining |
| 20 | +these imports for production. |
| 21 | + |
| 22 | +Example: |
| 23 | + |
| 24 | +```css |
| 25 | +@import "/components/normalize-css/normalize.css"; |
| 26 | + |
| 27 | +/* Utilities */ |
| 28 | + |
| 29 | +@import "/components/suit-utils/display.css"; |
| 30 | +@import "/components/suit-utils/layout.css"; |
| 31 | +@import "/components/suit-utils/space.css"; |
| 32 | +@import "/components/suit-utils/state.css"; |
| 33 | +@import "/components/suit-utils/text.css"; |
| 34 | +@import "/components/suit-utils/link.css"; |
| 35 | + |
| 36 | +@import "/components/app-css-utils/mycustom-util.css"; |
| 37 | +... |
| 38 | +``` |
| 39 | + |
| 40 | +### Templating |
| 41 | + |
| 42 | +Apply the desired trait, or combination of traits, directly to the HTML element |
| 43 | +in a component's template. |
| 44 | + |
| 45 | +These simple utilities can be used to create a wide variety of UI patterns that |
| 46 | +can form the basis for virtual and specific components. |
| 47 | + |
| 48 | +The following contrived example would be a structural template for a simple |
| 49 | +tweet-like component. You would then create a new component CSS file to house |
| 50 | +any additional, specific styles that are needed to fully realise this |
| 51 | +component. |
| 52 | + |
| 53 | +```html |
| 54 | +<article class="tweet"> |
| 55 | + <a class="obj-end" href="[permalink]"> |
| 56 | + [timestamp] |
| 57 | + </a> |
| 58 | + <a class="obj-start" href="[href]"> |
| 59 | + <img src="[src]" alt="[username]'s avatar"> |
| 60 | + </a> |
| 61 | + <div class="nbfc"> |
| 62 | + <a class="link-complex" href="[url]"> |
| 63 | + <span class="link-complex__target">[full-name]</span> |
| 64 | + <span>@username</span> |
| 65 | + </a> |
| 66 | + |
| 67 | + <p> |
| 68 | + <a class="link-complex" href="#"> |
| 69 | + @<span class="link-complex__target">username</span> |
| 70 | + </a> |
| 71 | + [tweet-text] |
| 72 | + </p> |
| 73 | + |
| 74 | + <div> |
| 75 | + <a href="#"> |
| 76 | + <span>Expand</span> |
| 77 | + <span class="is-hidden">Collapse</span> |
| 78 | + </a> |
| 79 | + <a class="link-complex" href="#"> |
| 80 | + <i class="icon icon--reply"></i> |
| 81 | + <span class="link-complex__target">Reply</span> |
| 82 | + </a> |
| 83 | + <a href="#"> |
| 84 | + <i class="icon icon--favorite"></i> |
| 85 | + <span class="is-vishidden">Favorite</span> |
| 86 | + </a> |
| 87 | + ... |
| 88 | + </div> |
| 89 | + </div> |
| 90 | +</article> |
| 91 | +``` |
| 92 | + |
| 93 | +## Browser support |
| 94 | + |
| 95 | +* Google Chrome (latest) |
| 96 | +* Opera (latest) |
| 97 | +* Firefox 4+ |
| 98 | +* Safari 5+ |
| 99 | +* Internet Explorer 8+ |
0 commit comments