Skip to content

Commit 336f27e

Browse files
committed
Add docs
1 parent 9e2e590 commit 336f27e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

History.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.4.0 / 2013-XX-XX
2+
==================
3+
4+
* source map generation
15

26
1.3.2 / 2013-10-18
37
==================

Readme.md

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,28 @@
22

33
CSS compiler using the AST provided by [css-parse](https://github.com/visionmedia/css-parse).
44

5+
## Usage
6+
7+
`css-stringify` exports a single function which dumps CSS AST:
8+
9+
var stringify = require('css-stringify');
10+
var parse = require('css-parse');
11+
12+
var ast = parse('body { font-size: 12px; }');
13+
14+
var str = stringify(ast);
15+
16+
To get compressed output:
17+
18+
var compressed = stringify(ast, {compress: true});
19+
20+
To get a source map:
21+
22+
var result = stringify(ast, {sourcemap: true});
23+
24+
result.code // string with CSS
25+
result.map // source map
26+
527
## Performance
628

729
Formats 15,000 lines of CSS (2mb) in 23ms on my macbook air.

index.js

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ var Identity = require('./lib/identity');
1111
*
1212
* @param {Object} node
1313
* @param {Object} [options]
14+
* @param {Boolean} [options.sourcemap] generate source map,
15+
* if set to true this will change return value to
16+
* `{code: '...', map: {...}}`, `node` argument should contain
17+
* position information (e.g. parsed by css-parse with
18+
* `position` option set to `true`)
19+
* @param {Boolean} [options.compress] compress output (ignores indent option)
20+
* @param {String} [options.indent] a string used for indents (defaults to 2 spaces)
21+
*
1422
* @return {String}
1523
* @api public
1624
*/

0 commit comments

Comments
 (0)