UNPKG

4.77 kBMarkdownView Raw
1
2# pub-server <br>
3[![](/images/run2.jpg)](https://jldec.github.io/pub-doc/)
4
5**pub-server**, or **pub** for short is an HTML generator+editor entirely written in javascript.
6
7The following use-cases are supported
8
9- Command-line tool for generating static websites
10- Web server for previewing generated HTML locally
11- Web server deployed on a PaaS like Heroku
12
13
14For users with node.js, pub-server provides a simple command-line utility which can render an HTML website from markdown in any directory. The generated output uses npm-installable themes and is fully customizable.
15
16The generator+editor can also run in-browser, allowing non-technical users to edit and instantly preview the generated HTML, without first installing pub-server themselves.
17
18To see this in action, check out the docs at http://jldec.github.io/pub-doc/. The editor appears when you click on the [edit](http://jldec.github.io/pub-doc/pub/?page=%2F) button at the top right.
19Feel free to play around - in this instance, your changes will not be recorded.
20
21Other examples include a [presentation theme](https://github.com/jldec/pub-sample-deck), a [flexbox design](https://github.com/jldec/pub-theme-brief), and a [blog](http://blog.pubblz.com/)
22
23## roadmap
24
25**pub-server** is usable today by anyone comfortable using GitHub and command line tools, to publish high-quality HTML content with custom designs.
26
27### near-term backlog
28- ~~Improved documentation~~ _(better doc published 2015-10-26)_
29- Fix editor to work on mobile devices
30- Self-service GitHub Pages workflow with save and re-publish
31- Basic form processing api
32- Dropbox interface for images
33- Single-page website theme
34- More complete blog theme
35
36### medium-term backlog
37- Single-file pub format with integrated pub-config
38- Photo-centric consumer publishing workflow
39- Private publishing
40- Atom editor plugin for designers
41- Windows support
42- npm v3 support
43- HTTPS hosting
44
45### longer-term backlog
46- WYSIWYG editor based on Prosemirror
47- v2 architecture: React/Redux + Webpack
48- Modern designs for presentations with vector graphics and data-integration
49- Next-gen interactive designs, games, animations
50- Online editing of javascript, html, css/less
51
52
53![](/screenshots/screen1.png)
54
55![](/screenshots/screen.png)
56
57![](/screenshots/screen2.png)
58
59## installation
60
61using **pub-server** requires node.js or io.js.
62
63``` bash
64npm install -g pub-server
65```
66
67OSX and Linux are working, Windows support is coming - PRs welcome.
68
69
70## usage
71
72- `pub` (with no options) serves `*.md` in the current directory or looks for a `pub-config.js`. The default theme is useful for previewing GitHub README.md files like this one. The server will watch for changes and update http://localhost:3001/ whenever markdown files or CSS or other static files are saved.
73
74- `pub -O` generates .html and other static files (including generator + editor) to `./out`.
75
76- `pub -S <dir>` serves static files from any directory. It will mimic the behavior of GitHub Pages, looking for index.html files in folders, and redirecting from /folder-name to /folder-name/
77
78- `pub -h` shows the usage info below:
79
80```
81pub-server v1.9.21
82
83usage: pub [opts] [dir]
84opts:
85 -h, --help output usage information
86 -p, --port <port> server port [3001]
87 -t, --theme <name> theme module-name or dir, repeatable
88 -o, --output-path <dir> output dir [./out]
89 -O, --output-only output html, scripts, static files and exit
90 -G, --html-only output generated html files and exit
91 -r, --root <prefix> generate /prefix urls, "." means path relative
92 -s, --static <dir> static dir, repeatable, supports <dir>,<route>
93 -S, --static-only <dir> serve only static files from <dir>
94 -C, --config show config and exit
95 -I, --ignore-config ignore pub-config file
96 -P, --pages show pages and templates and exit
97 -w, --watch-pkgs also watch inside packages
98 -W, --no-watch disable watcher entirely
99 -K, --no-sockets no websockets
100 -E, --no-editor website only, no editor
101 -m, --minify minify scripts
102 -d, --dbg enable scriptmaps and client-side debug traces
103 -D, --debug node --debug (server and client-side)
104 -B, --debug-brk node --debug-brk (server and client-side)
105```
106
107## credits
108
109Major dependencies include:
110
111- [express](http://expressjs.com/)
112- [marked](https://github.com/chjj/marked)
113- [handlebars](http://handlebarsjs.com/)
114- [browserify](http://browserify.org/) and [browserify-middleware](https://github.com/ForbesLindesay/browserify-middleware)
115- [chokidar](https://www.npmjs.com/package/chokidar)
116- [socket.io](http://socket.io/)
117- [passport](http://passportjs.org/)
118
119`npm ls` will list them all.