@@ -18,91 +18,127 @@ var Emitter = require('events').EventEmitter,
18
18
* Initialize CLI
19
19
*/
20
20
21
- var cli = meow ( {
22
- pkg : '../package.json' ,
21
+ var cli = meow ( `
22
+ Usage:
23
+ node-sass [options] <input.scss>
24
+ cat <input.scss> | node-sass [options] > output.css
25
+
26
+ Example: Compile foobar.scss to foobar.css
27
+ node-sass --output-style compressed foobar.scss > foobar.css
28
+ cat foobar.scss | node-sass --output-style compressed > foobar.css
29
+
30
+ Example: Watch the sass directory for changes, compile with sourcemaps to the css directory
31
+ node-sass --watch --recursive --output css
32
+ --source-map true --source-map-contents sass
33
+
34
+ Options
35
+ -w, --watch Watch a directory or file
36
+ -r, --recursive Recursively watch directories or files
37
+ -o, --output Output directory
38
+ -x, --omit-source-map-url Omit source map URL comment from output
39
+ -i, --indented-syntax Treat data from stdin as sass code (versus scss)
40
+ -q, --quiet Suppress log output except on error
41
+ -v, --version Prints version info
42
+ --output-style CSS output style (nested | expanded | compact | compressed)
43
+ --indent-type Indent type for output CSS (space | tab)
44
+ --indent-width Indent width; number of spaces or tabs (maximum value: 10)
45
+ --linefeed Linefeed style (cr | crlf | lf | lfcr)
46
+ --source-comments Include debug info in output
47
+ --source-map Emit source map (boolean, or path to output .map file)
48
+ --source-map-contents Embed include contents in map
49
+ --source-map-embed Embed sourceMappingUrl as data URI
50
+ --source-map-root Base path, will be emitted in source-map as is
51
+ --include-path Path to look for imported files
52
+ --follow Follow symlinked directories
53
+ --precision The amount of precision allowed in decimal numbers
54
+ --error-bell Output a bell character on errors
55
+ --importer Path to .js file containing custom importer
56
+ --functions Path to .js file containing custom functions
57
+ --help Print usage info
58
+ ` , {
23
59
version : sass . info ,
24
- help : [
25
- 'Usage:' ,
26
- ' node-sass [options] <input.scss>' ,
27
- ' cat <input.scss> | node-sass [options] > output.css' ,
28
- '' ,
29
- 'Example: Compile foobar.scss to foobar.css' ,
30
- ' node-sass --output-style compressed foobar.scss > foobar.css' ,
31
- ' cat foobar.scss | node-sass --output-style compressed > foobar.css' ,
32
- '' ,
33
- 'Example: Watch the sass directory for changes, compile with sourcemaps to the css directory' ,
34
- ' node-sass --watch --recursive --output css' ,
35
- ' --source-map true --source-map-contents sass' ,
36
- '' ,
37
- 'Options' ,
38
- ' -w, --watch Watch a directory or file' ,
39
- ' -r, --recursive Recursively watch directories or files' ,
40
- ' -o, --output Output directory' ,
41
- ' -x, --omit-source-map-url Omit source map URL comment from output' ,
42
- ' -i, --indented-syntax Treat data from stdin as sass code (versus scss)' ,
43
- ' -q, --quiet Suppress log output except on error' ,
44
- ' -v, --version Prints version info' ,
45
- ' --output-style CSS output style (nested | expanded | compact | compressed)' ,
46
- ' --indent-type Indent type for output CSS (space | tab)' ,
47
- ' --indent-width Indent width; number of spaces or tabs (maximum value: 10)' ,
48
- ' --linefeed Linefeed style (cr | crlf | lf | lfcr)' ,
49
- ' --source-comments Include debug info in output' ,
50
- ' --source-map Emit source map (boolean, or path to output .map file)' ,
51
- ' --source-map-contents Embed include contents in map' ,
52
- ' --source-map-embed Embed sourceMappingUrl as data URI' ,
53
- ' --source-map-root Base path, will be emitted in source-map as is' ,
54
- ' --include-path Path to look for imported files' ,
55
- ' --follow Follow symlinked directories' ,
56
- ' --precision The amount of precision allowed in decimal numbers' ,
57
- ' --error-bell Output a bell character on errors' ,
58
- ' --importer Path to .js file containing custom importer' ,
59
- ' --functions Path to .js file containing custom functions' ,
60
- ' --help Print usage info'
61
- ] . join ( '\n' )
62
- } , {
63
- boolean : [
64
- 'error-bell' ,
65
- 'follow' ,
66
- 'indented-syntax' ,
67
- 'omit-source-map-url' ,
68
- 'quiet' ,
69
- 'recursive' ,
70
- 'source-map-embed' ,
71
- 'source-map-contents' ,
72
- 'source-comments' ,
73
- 'watch'
74
- ] ,
75
- string : [
76
- 'functions' ,
77
- 'importer' ,
78
- 'include-path' ,
79
- 'indent-type' ,
80
- 'linefeed' ,
81
- 'output' ,
82
- 'output-style' ,
83
- 'precision' ,
84
- 'source-map-root'
85
- ] ,
86
- alias : {
87
- c : 'source-comments' ,
88
- i : 'indented-syntax' ,
89
- q : 'quiet' ,
90
- o : 'output' ,
91
- r : 'recursive' ,
92
- x : 'omit-source-map-url' ,
93
- v : 'version' ,
94
- w : 'watch'
60
+ flags : {
61
+ errorBell : {
62
+ type : 'boolean' ,
63
+ } ,
64
+ functions : {
65
+ type : 'string' ,
66
+ } ,
67
+ follow : {
68
+ type : 'boolean' ,
69
+ } ,
70
+ importer : {
71
+ type : 'string' ,
72
+ } ,
73
+ includePath : {
74
+ type : 'string' ,
75
+ default : [ process . cwd ( ) ] ,
76
+ isMultiple : true ,
77
+ } ,
78
+ indentType : {
79
+ type : 'string' ,
80
+ default : 'space' ,
81
+ } ,
82
+ indentWidth : {
83
+ type : 'number' ,
84
+ default : 2 ,
85
+ } ,
86
+ indentedSyntax : {
87
+ type : 'boolean' ,
88
+ alias : 'i' ,
89
+ } ,
90
+ linefeed : {
91
+ type : 'string' ,
92
+ default : 'lf' ,
93
+ } ,
94
+ omitSourceMapUrl : {
95
+ type : 'boolean' ,
96
+ alias : 'x' ,
97
+ } ,
98
+ output : {
99
+ type : 'string' ,
100
+ alias : 'o' ,
101
+ } ,
102
+ outputStyle : {
103
+ type : 'string' ,
104
+ default : 'nested' ,
105
+ } ,
106
+ precision : {
107
+ type : 'number' ,
108
+ default : 5 ,
109
+ } ,
110
+ quiet : {
111
+ type : 'boolean' ,
112
+ default : false ,
113
+ alias : 'q' ,
114
+ } ,
115
+ recursive : {
116
+ type : 'boolean' ,
117
+ default : true ,
118
+ alias : 'r' ,
119
+ } ,
120
+ sourceMapContents : {
121
+ type : 'boolean' ,
122
+ } ,
123
+ sourceMapEmbed : {
124
+ type : 'boolean' ,
125
+ } ,
126
+ sourceMapRoot : {
127
+ type : 'string' ,
128
+ } ,
129
+ sourceComments : {
130
+ type : 'boolean' ,
131
+ alias : 'c' ,
132
+ } ,
133
+ version : {
134
+ type : 'boolean' ,
135
+ alias : 'v' ,
136
+ } ,
137
+ watch : {
138
+ type : 'boolean' ,
139
+ alias : 'w' ,
140
+ } ,
95
141
} ,
96
- default : {
97
- 'include-path' : process . cwd ( ) ,
98
- 'indent-type' : 'space' ,
99
- 'indent-width' : 2 ,
100
- linefeed : 'lf' ,
101
- 'output-style' : 'nested' ,
102
- precision : 5 ,
103
- quiet : false ,
104
- recursive : true
105
- }
106
142
} ) ;
107
143
108
144
/**
@@ -282,10 +318,6 @@ function watch(options, emitter) {
282
318
*/
283
319
284
320
function run ( options , emitter ) {
285
- if ( ! Array . isArray ( options . includePath ) ) {
286
- options . includePath = [ options . includePath ] ;
287
- }
288
-
289
321
if ( options . directory ) {
290
322
if ( ! options . output ) {
291
323
emitter . emit ( 'error' , 'An output directory must be specified when compiling a directory' ) ;
0 commit comments