Initial commit
[yaffs-website] / node_modules / sass-graph / readme.md
1 # Sass Graph
2
3 Parses Sass files in a directory and exposes a graph of dependencies
4
5 [![Build Status](https://travis-ci.org/xzyfer/sass-graph.svg?branch=master)](https://travis-ci.org/xzyfer/sass-graph)
6 [![npm version](https://badge.fury.io/js/sass-graph.svg)](http://badge.fury.io/js/sass-graph)
7 [![Dependency Status](https://david-dm.org/xzyfer/sass-graph.svg?theme=shields.io)](https://david-dm.org/xzyfer/sass-graph)
8 [![devDependency Status](https://david-dm.org/xzyfer/sass-graph/dev-status.svg?theme=shields.io)](https://david-dm.org/xzyfer/sass-graph#info=devDependencies)
9
10 ## Install
11
12 Install with [npm](https://npmjs.org/package/sass-graph)
13
14 ```
15 npm install --save-dev sass-graph
16 ```
17
18 ## Usage
19
20 Usage as a Node library:
21
22 ```js
23 var sassGraph = require('./sass-graph');
24 ```
25
26 Usage as a command line tool:
27
28 The command line tool will parse a graph and then either display ancestors, descendents or both.
29
30 ```
31 $ ./bin/sassgraph --help
32 Usage: bin/sassgraph <command> [options] <dir> [file]
33
34 Commands:
35   ancestors    Output the ancestors
36   descendents  Output the descendents
37
38 Options:
39   -I, --load-path   Add directories to the sass load path
40   -e, --extensions  File extensions to include in the graph
41   -j, --json        Output the index in json
42   -h, --help        Show help
43   -v, --version     Show version number
44
45 Examples:
46   ./bin/sassgraph descendents test/fixtures test/fixtures/a.scss
47   /path/to/test/fixtures/b.scss
48   /path/to/test/fixtures/_c.scss
49 ```
50
51 ## API
52
53 #### parseDir
54
55 Parses a directory and builds a dependency graph of all requested file extensions.
56
57 #### parseFile
58
59 Parses a file and builds its dependency graph.
60
61 ## Options
62
63 #### loadPaths
64
65 Type: `Array`
66 Default: `[process.cwd]`
67
68 Directories to use when resolved `@import` directives.
69
70 #### extensions
71
72 Type: `Array`
73 Default: `['scss', 'css']`
74
75 File types to be parsed.
76
77 ## Example
78
79 ```js
80 var sassGraph = require('./sass-graph');
81 console.log(sassGraph.parseDir('test/fixtures'));
82
83 //{ index: {,
84 //    '/path/to/test/fixtures/a.scss': {
85 //        imports: ['b.scss'],
86 //        importedBy: [],
87 //    },
88 //    '/path/to/test/fixtures/b.scss': {
89 //        imports: ['_c.scss'],
90 //        importedBy: ['a.scss'],
91 //    },
92 //    '/path/to/test/fixtures/_c.scss': {
93 //        imports: [],
94 //        importedBy: ['b/scss'],
95 //    },
96 //}}
97 ```
98
99 ## Running Mocha tests
100
101 You can run the tests by executing the following commands:
102
103 ```
104 npm install
105 npm test
106 ```
107
108 ## Authors
109
110 Sass graph was originally written by [Lachlan Donald](http://lachlan.me).
111 It is now maintained by [Michael Mifsud](http://twitter.com/xzyfer).
112
113 ## License
114
115 MIT