heraldry
v1.1.9
Published
Listens and sync to browser
Downloads
16
Readme
Heraldry
Web hosting system with hot reloading. Minimal, efficient and cross-platform.
Why?
Without using webpack serve, there aren't many solution for simple, generic web hosting solutions that would do hot-reloading out of the box along with full net casts on 404 pages.
How does it work?
It's very simple, heraldy generates a script that will allow for an EventSource
to be injected into your index.html
. On cleanup the script is removed.
The script does nothing more than send a browser nudge to refresh on /subscribe
whenever it notices changes occure within the serving directory.
See chokidar for chokidar.watch('.').on('all', () => log("file changed!")
for all changes to prevoke a hot reload.
Note: It does not bundle your js code. It does nothing more then serve the directory.
Getting Started
Install with npm:
npm install heraldry
Then import heraldry and use:
import heraldry from "heraldry";
heraldry();
// or
heraldry({ port: 3001 });
Usage:
heraldry({options})
options
(object) Options defined below:
Port
port
(default:3000
: number). Indicates what port to serve your web app on.
Slashtype
slashtype
(default: based on process.platform :\\
|/
). To help heraldry determine how to access your file system. By default we check the platform to select\\
for windows or/
for all other systems. By running docker or other conatiner systems on windows you could be setting up a forward slash system and would require other then the default system.
Note: Heraldry is currently hardcodded to require the serving directory to be public
.
That's about it. Trying to keep it simple but as I do use this personally, I forsee myself improving it until I'm at a place I am happy with. Happy hacking!