statik

command module
v0.0.0-...-25e3b2b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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]

{
  "watch": {
    "src": [
      "yarn buildsrc"
    ],
    "lib": [
      "yarn buildlib"
    ]
  }
}

To run the server:

./statik

Autoreload

Add this to the index.html to enable the autoreload feature:

<script type="text/javascript">
  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();
    }
  })();
</script>

Server configuration

{
  "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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL