├── .gitignore
├── LICENSE.md
├── README.md
├── _components
├── buttons.html
├── buttons_groups.html
├── buttons_sizes.html
├── typography_headings.html
└── typography_texts.html
├── _config.yml
├── _includes
└── component.html
├── _layouts
└── default.html
├── _sass
├── base
│ ├── _base.scss
│ ├── _syntax-highlighting.scss
│ └── _typography.scss
├── components
│ └── _buttons.scss
├── layout
│ └── _styleguide.scss
├── utils
│ └── _helpers.scss
└── vendor
│ └── _normalize.scss
├── css
└── screen.scss
└── index.html
/.gitignore:
--------------------------------------------------------------------------------
1 | _site
2 | .sass-cache
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Jérôme Coupé
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Simple Jekyll based style guide
2 |
3 | This is a simple style guide generator in [Jekyll](http://jekyllrb.com). It is not particularly original but I tried to make it as flexible as possible to correspond to various use cases.
4 |
5 | - simple list-based style guides ([Code for America style guide](http://codeforamerica.clearleft.com/) by [Clearleft](http://clearleft.com/))
6 | - more complex style guides using posts or pages ([Lonely Planet "Rizzo" style guide](http://rizzo.lonelyplanet.com/styleguide/design-elements/colours) by [Lonely Planet](http://www.lonelyplanet.com/))
7 |
8 | I used a custom collection (with output set to false) rather than posts or pages so I can use those to create more complex style guides if needed.
9 |
10 | ## Demo
11 |
12 | Here is what the [default output looks like](http://jeromecoupe.github.io/jekyllstyleguide/).
13 |
14 | ## How it works
15 |
16 | Define components in the `_components` folder. Each component is output twice (code and preview) using a single include file `_includes/component.html`.
17 |
18 | - The `type` variable in components is used to be able to group them (using the `group_by` parameter) or only display a certain type of components (using the `where` parameter) in more complex style guides.
19 | - The `sass` variable is used to reference the sass file for all the CSS rules applied to each component.
20 | - Easy to expand the list of component variables: maybe you need notes or js files. Just update your components YAML front matter and your component include and you're good to go.
21 |
22 | Display components in your templates using simple `{% for %}` loops.
23 |
24 | Simple `{% for %}` loop to display all components (ordered using file names)
25 |
26 | ```liquid
27 | {% assign entries = site.components %}
28 | {% for entry in entries %}
29 | {% include component.html %}
30 | {% endfor %}
31 | ```
32 |
33 | `{% for %}` loop using `group_by` to display components grouped by type
34 |
35 | ```liquid
36 | {% assign componentsByType = site.components | group_by:"type" %}
37 | {% for type in componentsByType %}
38 |
{{ type.name | capitalize }}
39 | {% for entry in type.items %}
40 | {% include component.html %}
41 | {% endfor %}
42 | {% endfor %}
43 | ```
44 |
45 | When creating a more detailed style guides using pages, it is useful to be able to display only a certain type of components in your pages using a `where` parameter in your `{% for %}` loop
46 |
47 | ```liquid
48 | {% assign entries = site.components | where:"type","buttons" %}
49 | {% for entry in entries %}
50 | {% include component.html %}
51 | {% endfor %}
52 | ```
53 |
--------------------------------------------------------------------------------
/_components/buttons.html:
--------------------------------------------------------------------------------
1 | ---
2 | title: Buttons
3 | scss: '/_scss/components/buttons.scss'
4 | type: buttons
5 | ---
6 | Button text
7 |
8 |
9 |
--------------------------------------------------------------------------------
/_components/buttons_groups.html:
--------------------------------------------------------------------------------
1 | ---
2 | title: Button group
3 | scss: '/_scss/components/buttons.scss'
4 | type: buttons
5 | ---
6 |
Large text (21px) Lorem ipsum dolor sit amet, consectetur adipisicing elit. Incidunt veritatis sequi nobis earum dicta vero impedit esse at, debitis doloremque eius inventore qui, et dolores eaque eos iste repellendus non.
9 |
10 |
Level two title
11 |
Default text (16px) Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
12 |
13 |
list item
14 |
list item
15 |
list item
16 |
17 |
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
18 |
19 |
list item
20 |
list item
21 |
list item
22 |
23 |
Small text (14px) Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Boilerplate for creating components based style guides using Jekyll. Here is the Github repository for it, should you want to have a peek at the code, fork it or report an issue.
8 |
9 | {% assign entries = site.components %}
10 | {% for entry in entries %}
11 | {% include component.html %}
12 | {% endfor %}
13 |
14 | {% comment %}
15 |
16 | If you want to make sure your types are grouped (file names are not enough), you could use this group_by loop instead
17 |
18 | {% assign componentsByType = site.components | group_by:"type" %}
19 | {% for type in componentsByType %}
20 |
{{ type.name | capitalize }}
21 | {% for entry in type.items %}
22 | {% include component.html %}
23 | {% endfor %}
24 | {% endfor %}
25 |
26 | {% endcomment %}
27 |
28 |
29 |
30 | {% comment %}
31 |
32 | If you want to use pages and/or posts to create a more comple styleguide with pages / intros for every type of components, you can use these where loops on those pages / posts instead
33 |
34 | {% assign entries = site.components | where:"type","buttons" %}
35 | {% for entry in entries %}
36 | {% include component.html %}
37 | {% endfor %}
38 |
39 | {% assign entries = site.components | where:"type","typography" %}
40 | {% for entry in entries %}
41 | {% include component.html %}
42 | {% endfor %}
43 |
44 | {% endcomment %}
45 |
--------------------------------------------------------------------------------