You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+72-60
Original file line number
Diff line number
Diff line change
@@ -23,22 +23,29 @@ Usage is the same as all other `connect` middleware:
23
23
server.listen(6969);
24
24
````
25
25
26
+
Of note, earlier versions of `connect` actually came with a module like this, but they do not any longer.
27
+
26
28
27
29
## Settings
28
30
29
-
The compiler middleware takes a settings object, minimally containing a list of compilers to enable (`enabled`). Most uses will also specify a source directory (`src`).
31
+
The compiler middleware takes a settings object, minimally containing a list of compilers to
32
+
enable (`enabled`). Most uses will also specify a source directory (`src`).
30
33
31
34
<table>
32
-
<col>
33
-
<col width="25%">
34
-
<col>
35
-
<col width="50%">
36
35
<thead>
37
36
<tr>
38
-
<th>name</th>
39
-
<th>type</th>
40
-
<th>default</th>
41
-
<th>description</th>
37
+
<th>
38
+
name
39
+
</th>
40
+
<th>
41
+
type
42
+
</th>
43
+
<th>
44
+
default
45
+
</th>
46
+
<th>
47
+
description
48
+
</th>
42
49
</tr>
43
50
</thead>
44
51
<tbody>
@@ -49,9 +56,7 @@ The compiler middleware takes a settings object, minimally containing a list of
49
56
<td>
50
57
<code>String</code>, <code>String[]</code>
51
58
</td>
52
-
<td>
53
-
54
-
</td>
59
+
<td></td>
55
60
<td>
56
61
<strong>Required</strong> Enabled compiler id(s). See below for included compilers.
57
62
</td>
@@ -78,7 +83,7 @@ The compiler middleware takes a settings object, minimally containing a list of
78
83
<code>String</code>
79
84
</td>
80
85
<td>
81
-
<code>src</code><br>
86
+
<code>src</code> or<br>
82
87
<code>src[0]</code> if Array
83
88
</td>
84
89
<td>
@@ -90,11 +95,12 @@ The compiler middleware takes a settings object, minimally containing a list of
Allows you to specify multiple, ordered <code>src</code>-<code>dest</code> pairs. Only one of <code>roots</code> or <code>src</code> is required; <code>roots</code> takes precedence over <code>src</code> if present.
103
+
Allows you to specify multiple, ordered <code>src</code>-<code>dest</code> pairs. One of <code>roots</code> or <code>src</code> is required; <code>roots</code> takes precedence over <code>src</code> if present.
98
104
</td>
99
105
</tr>
100
106
<tr>
@@ -105,7 +111,7 @@ The compiler middleware takes a settings object, minimally containing a list of
105
111
<code>String</code> , <code>Number</code>
106
112
</td>
107
113
<td>
108
-
<code>warn</code>
114
+
<code>WARN</code>
109
115
</td>
110
116
<td>
111
117
Logging verbosity. Valid values (case-insensitive): <code>error</code>, <code>warn</code>, <code>info</code>, <code>debug</code>, <code>silent</code>, or a numeric constant (as found in <code>LOG</code>).
@@ -207,6 +213,20 @@ The compiler middleware takes a settings object, minimally containing a list of
207
213
If <code>true</code>-y, directories are resolved with the supplied filename, where <code>true</code> maps to <code>'index.html'</code>.
208
214
</td>
209
215
</tr>
216
+
<tr>
217
+
<td>
218
+
<strong>ignore</strong>
219
+
</td>
220
+
<td>
221
+
<code>RegExp</code>
222
+
</td>
223
+
<td>
224
+
<code>/\.(jpe?g!gif!png)$/i</code>
225
+
</td>
226
+
<td>
227
+
Requests matching this pattern are short-circuit ignored, and no compiler matching occurs.
228
+
</td>
229
+
</tr>
210
230
<tr>
211
231
<td>
212
232
<strong>allowed_methods</strong>
@@ -240,56 +260,48 @@ The compiler middleware takes a settings object, minimally containing a list of
240
260
241
261
## Compilers
242
262
243
-
-### CoffeeScriptCompiler
244
-
245
-
246
-
-### CocoCompiler
247
-
248
-
249
-
-### CommonJSCompiler
250
-
251
-
252
-
-### UglifyCompiler
253
-
254
-
255
-
-### JadeCompiler
256
-
257
-
258
-
-### StylusCompiler
259
-
260
-
261
-
-### LessCompiler
262
-
263
-
264
-
-### SassJSCompiler
265
-
266
-
267
-
-### SassRubyCompiler
268
-
269
-
270
-
-### JisonCompiler
271
-
272
-
273
-
-### YamlCompiler
274
-
275
-
263
+
To enable a compiler, you specify its `id`, which you can get from the handy list that follows. Some
264
+
compilers take options, which you pass using the `options` setting using the compiler `id` as the
265
+
key.
276
266
277
-
## API
267
+
For example, to disable the `bare` option for the CoffeeScript compiler, you'd do something like:
|**enabled**|`String`, `String[]`||**Required** Enabled compiler id(s). See below for included compilers. |
5
+
|**src**|`String`, `String[]`| cwd | Directories to search for source files to compile. |
6
+
|**dest**|`String`|`src` or <br/> `src[0]` if Array | Directory to write compiled result. |
7
+
|**roots**|`{src:dest, ...}`, <br/> `[[src, dest], ...]`|| Allows you to specify multiple, ordered `src`-`dest` pairs. One of `roots` or `src` is required; `roots` takes precedence over `src` if present. |
8
+
|**log_level**|`String` , `Number`|`WARN`| Logging verbosity. Valid values (case-insensitive): `error`, `warn`, `info`, `debug`, `silent`, or a numeric constant (as found in `LOG`). |
9
+
|**create_dirs**|`Boolean`|`true`| Creates intermediate directories for destination files. |
10
+
|**mount**|`String`|| Prefix trimmed off request path before matching/processing. |
11
+
|**delta**|`Number`|`0`| Delta `mtime` (in seconds) required for a derived file to be considered stale, and therefore recompiled. By default, any change will cause a file to be recompiled on next request. |
12
+
|**expires**|`Boolean`|`false`| Automatically treat files as stale if this old in secs. |
13
+
|**external_timeout**|`Number`|`3000`| Milliseconds after which to kill subprocess commands. |
14
+
|**cascade**|`Boolean`|`false`| Invoke all compilers that match? otherwise, only first. |
15
+
|**resolve_index**|`Boolean` , `String`|`false`| If `true`-y, directories are resolved with the supplied filename, where `true` maps to `'index.html'`. |
16
+
|**ignore**|`RegExp`|`/\.(jpe?g!gif!png)$/i`| Requests matching this pattern are short-circuit ignored, and no compiler matching occurs. |
17
+
|**allowed_methods**|`String[]`|`['GET']`| HTTP methods compiler should process. This setting is global-only -- per-compiler overrides specified via `options` will have no effect. |
18
+
|**options**|`{compilerId:settings, ...}`|| Hash of additional per-compiler options, mapped by compiler id. Each compiler is supplied a copy of the `settings` object; if additional options are supplied in this way for a given compiler, they will be merged into the settings (and override any colliding top-level keys). |
0 commit comments