https://github.com/synw/statik
A configurable watch-autoreload development server
https://github.com/synw/statik
Last synced: 3 months ago
JSON representation
A configurable watch-autoreload development server
- Host: GitHub
- URL: https://github.com/synw/statik
- Owner: synw
- License: mit
- Created: 2021-02-25T18:11:39.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-04-03T17:31:47.000Z (about 4 years ago)
- Last Synced: 2025-02-19T12:51:13.413Z (4 months ago)
- Language: Go
- Size: 23.4 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Statik
A configurable watch/autoreload development server. Watch directories for changes and
run commands## Install
Get a binary release for Linux or clone and compile with Go
```
wget https://github.com/synw/statik/releases/download/0.1.0/statik
chmod a+x statik
```## Watchers
Create a `statik.config.json` file and set the watchers
Syntax: directory: [*list_of_commands*]
```javascript
{
"watch": {
"src": [
"yarn buildsrc"
],
"lib": [
"yarn buildlib"
]
}
}
```To run the server:
```
./statik
```## Autoreload
Add this to the index.html to enable the autoreload feature:
```html
const ip = "localhost"; // The ip of the server: ex: 192.168.1.3 or localhost
(function () {
var conn = new WebSocket("ws://" + ip + ":8042/ws");
conn.onmessage = function (evt) {
window.location.reload();
}
})();```
## Server configuration
```javascript
{
"root": "build/web",
"port": 8090,
"https": false,
"watch": {}
}
```**root**: the root directory to serve, relative path
**port**: the port to run the server on
**https**: run the server in https mode
## Flags
Optional flags are available, they take precedence over config params if set:
**-v**: verbose mode
**-nw**: disable the watchers
**-nr**: disable the autoreload
**-nc**: do not use the config file
**-ns**: do not run the web server
**-https**: run the server in https mode
**-port**: the port to run the server on
**-root**: the root directory to serve, relative path
**-certs**: help about how to generate certificates for the https mode
Example:
```
./statik -https -nr -v -root=somedir/somesubdir
```