UNPKG

4.47 kBMarkdownView Raw
1Styledown
2=========
3
4Write maintainable CSS styleguides efficiently using a Markdown.
5**[See example ▸][example]**
6
7[![Example](https://cdn.rawgit.com/styledown/styledown/81a1d9c/examples/screenshot.png)][example]
8
9[![Status](http://img.shields.io/travis/styledown/styledown/master.svg?style=flat)](https://travis-ci.org/styledown/styledown "See test builds")
10
11Installation
12------------
13
14``` bash
15$ npm install -g styledown
16$ styledown --help
17```
18
19[![npm version](http://img.shields.io/npm/v/styledown.svg?style=flat)](https://npmjs.org/package/styledown "View this project on npm")
20
21[example]: http://cdn.rawgit.com/styledown/styledown/v1.0.1/examples/bootstrap/index.html
22
23How it works
24------------
25
26Styledown is made to work in most web development setups. It doesn't favor any
27framework or language or any preprocessor.
28
29 * [Document][doc] your CSS files with inline comments, or as a separate `.md` file.
30 * Create a file with styleguide [configuration][conf].
31 * Invoke `styledown *.css > styleguide.html`.
32 * Enjoy your styleguide! Read more about the [format][fmt].
33
34[doc]: docs/Documenting.md
35[conf]: docs/Configuration.md
36[fmt]: docs/Format.md
37
38Quickstart guide
39----------------
40
41Here's a generic guide on getting started with Styledown on any project. We're
42gonna assume that you're using Sass and that your project bundles all CSS files
43into one file.
44
45Let's assume that your files are in `css/`, and that your final styleguide will
46be in `public/styleguide.html`.
47
48```
49 Example setup
50
51.----------------------. .---------------------.
52| css/ | | |
53| config.md | | public/ |
54| button.scss | ==> | styleguide.html |
55| forms.scss | | |
56| whatever.scss | | |
57'----------------------' '---------------------'
58```
59
60#### Step 1: Document
61
62Document your project's stylesheets with inline comments, or as separate `.md`
63files.
64
65```css
66/**
67 * Component name:
68 * `.your-component-here` - documentation on what your
69 * component is goes here. Markdown is encouraged.
70 *
71 * @example
72 * div.your-component-here
73 * h3 Sample code
74 * p goes here
75 */
76
77.your-component-here {
78 display: block;
79 ...
80}
81```
82
83Read more: **[Documenting ▸](docs/Documenting.md)**
84
85#### Step 2: Configure
86
87Make a file, let's call it `config.md`. (`styledown --conf > config.md`) This
88lets you define what will be in the output head/body.
89
90```markdown
91# Styleguide options
92
93### Head
94
95 link(rel="stylesheet" href="/assets/application.css")
96 link(rel='stylesheet' href='https://cdn.rawgit.com/styledown/styledown/v1.0.1/data/styledown.css')
97 script(src='https://cdn.rawgit.com/styledown/styledown/v1.0.1/data/styledown.js')
98
99### Body
100
101 h1 My Awesome Styleguides
102 div#styleguides(sg-content)
103```
104
105The first one (`application.css`) should point to your project's concatenated
106stylesheets. The second and third one (`styledown.css` and `styledown.js`)
107point to the default Styledown CSS/JS files.
108
109Read more: **[Configuration ▸](docs/Configuration.md)**
110
111#### Step 3: Build
112
113Invoke `styledown` to generate an HTML file. (Mkae sure that the extras.css is
114passed on the end, since anything after the "Styleguide options" heading is ignored.)
115
116```bash
117$ styledown -i css/*.css css/config.md > public/styleguides.html
118```
119
120#### Enjoy!
121
122Now open `public/styleguides.html` in your browser.
123
124Usage
125-----
126
127Styledown generates `.html` styleguides. It can take CSS files or Markdown
128files, or a combination of the two.
129
130__Inline CSS mode:__ Parses comments from CSS files. This is what happens when
131you pass .css, .sass, .scss, .less and .styl files.
132
133```
134$ styledown *.css > styleguide.html
135```
136
137__Markdown mode:__ Takes Markdown files.
138
139```
140$ styledown *.md > styleguide.html
141```
142
143Markup format
144-------------
145
146Read more: **[Markup format ▸](docs/Format.md)**
147
148## :copyright:
149
150**Styledown** © 2013+, Rico Sta. Cruz. Released under the [MIT License].<br>
151Authored and maintained by Rico Sta. Cruz with help from [contributors].
152
153> [ricostacruz.com](http://ricostacruz.com) &nbsp;&middot;&nbsp;
154> GitHub [@rstacruz](https://github.com/rstacruz) &nbsp;&middot;&nbsp;
155> Twitter [@rstacruz](https://twitter.com/rstacruz)
156
157[MIT License]: http://mit-license.org/
158[contributors]: http://github.com/styledown/styledown/contributors
159[highlight.js]: http://highlightjs.org/
160[Jade]: http://jade-lang.com/