UNPKG

3.79 kBMarkdownView Raw
1workit
2======
3
4The stupid development server.
5
6- Reloads browser on source-file change.
7- Serves [CoffeeScript][coff], [Jade][jade], and [Stylus][styl] like a champ.
8- Compiled output sent directly to browser for a pristine working directory.
9- No caching so you're guaranteed to get the latest changes.
10
11[coff]: http://coffeescript.org/
12[jade]: http://jade-lang.com/
13[styl]: http://learnboost.github.com/stylus/
14
15Built with [Connect][conn], [Socket.io][sock], [Commander.js][comm], and
16[hound][houn]. Inspired by visionmedia's [serve][serv] and nodejitsu's
17[http-server][hser].
18
19[conn]: http://senchalabs.org/connect/
20[sock]: http://socket.io/
21[comm]: http://visionmedia.github.com/commander.js/
22[houn]: https://github.com/beefsack/node-hound/
23[serv]: https://github.com/visionmedia/serve/
24[hser]: https://github.com/nodeapps/http-server/
25
26Installation
27------------
28
29Via [npm](http://npmjs.org/):
30
31 $ npm install -g workit
32
33Usage
34-----
35
36### workit(1)
37
38```
39
40 Usage: workit [options] [dir]
41
42 Options:
43
44 -h, --help output usage information
45 -V, --version output the version number
46 -a, --address <string> set hostname [127.0.0.1]
47 -f, --format <string> connect logger format [dev]
48 -p, --port <number> set port number [3000]
49
50 Examples:
51
52 Serve the current directory
53
54 $ cd /var/www
55 $ workit
56 Serving /var/www at http://localhost:3000/
57
58 Serve a specific directory
59
60 $ workit /var/www/foo
61 Serving /var/www/foo at http://localhost:3000/
62
63 Serve a specific directory with options
64
65 $ workit -a 192.168.0.1 -p 8080 /var/www/foo
66 Serving /var/www/foo at http://192.168.0.1:8080/
67
68```
69
70Features
71--------
72
73### Preprocessing
74
75File extensions are taken literally. If you request jade, you'll get jade:
76
77```
78
79 $ curl http://localhost:3000/foo.jade
80 !!! 5
81 title Hello world
82 link(rel='stylesheet', href='foo.css')
83 script(src='/connect-reload.js')
84 script(src='foo.js')
85
86```
87
88If you want the slightly-more-useful compiled html, request `.htm` or `.html`
89instead:
90
91```
92
93 $ curl http://localhost:3000/foo.html
94 <!DOCTYPE html><title>Hello world</title><link rel="stylesheet" href="foo.css"><script src="/connect-reload.js"></script><script src="foo.js"></script>
95
96```
97
98Same goes for `.coffee` vs `.js` and `.styl` vs `.css`.
99
100### Auto-reload
101
102To enable automatic reloading of a page when a file in your project is created
103or changed, simply include the virtual `/connect-reload.js` in your markup:
104
105```
106
107 <!-- HTML -->
108 <script src="/connect-reload.js"></script>
109
110 // Jade
111 script(src='/connect-reload.js')
112
113```
114
115License
116-------
117
118(The MIT License)
119
120Copyright (c) Shannon Moeller &lt;me@shannonmoeller.com&gt;
121
122Permission is hereby granted, free of charge, to any person obtaining
123a copy of this software and associated documentation files (the
124'Software'), to deal in the Software without restriction, including
125without limitation the rights to use, copy, modify, merge, publish,
126distribute, sublicense, and/or sell copies of the Software, and to
127permit persons to whom the Software is furnished to do so, subject to
128the following conditions:
129
130The above copyright notice and this permission notice shall be
131included in all copies or substantial portions of the Software.
132
133THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
134EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
136IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
137CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
138TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
139SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.