1 | Styledown
|
2 | =========
|
3 |
|
4 | Write 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 |
|
11 | Installation
|
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 |
|
23 | How it works
|
24 | ------------
|
25 |
|
26 | Styledown is made to work in most web development setups. It doesn't favor any
|
27 | framework 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 |
|
38 | Quickstart guide
|
39 | ----------------
|
40 |
|
41 | Here's a generic guide on getting started with Styledown on any project. We're
|
42 | gonna assume that you're using Sass and that your project bundles all CSS files
|
43 | into one file.
|
44 |
|
45 | Let's assume that your files are in `css/`, and that your final styleguide will
|
46 | be 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 |
|
62 | Document your project's stylesheets with inline comments, or as separate `.md`
|
63 | files.
|
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 |
|
83 | Read more: **[Documenting ▸](docs/Documenting.md)**
|
84 |
|
85 | #### Step 2: Configure
|
86 |
|
87 | Make a file, let's call it `config.md`. (`styledown --conf > config.md`) This
|
88 | lets 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 |
|
105 | The first one (`application.css`) should point to your project's concatenated
|
106 | stylesheets. The second and third one (`styledown.css` and `styledown.js`)
|
107 | point to the default Styledown CSS/JS files.
|
108 |
|
109 | Read more: **[Configuration ▸](docs/Configuration.md)**
|
110 |
|
111 | #### Step 3: Build
|
112 |
|
113 | Invoke `styledown` to generate an HTML file. (Mkae sure that the extras.css is
|
114 | passed 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 |
|
122 | Now open `public/styleguides.html` in your browser.
|
123 |
|
124 | Usage
|
125 | -----
|
126 |
|
127 | Styledown generates `.html` styleguides. It can take CSS files or Markdown
|
128 | files, or a combination of the two.
|
129 |
|
130 | __Inline CSS mode:__ Parses comments from CSS files. This is what happens when
|
131 | you 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 |
|
143 | Markup format
|
144 | -------------
|
145 |
|
146 | Read more: **[Markup format ▸](docs/Format.md)**
|
147 |
|
148 | ## :copyright:
|
149 |
|
150 | **Styledown** © 2013+, Rico Sta. Cruz. Released under the [MIT License].<br>
|
151 | Authored and maintained by Rico Sta. Cruz with help from [contributors].
|
152 |
|
153 | > [ricostacruz.com](http://ricostacruz.com) ·
|
154 | > GitHub [@rstacruz](https://github.com/rstacruz) ·
|
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/
|