Categorygithub.com/mattn/goemon
repositorypackage
0.0.3
Repository: https://github.com/mattn/goemon.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

goemon

Go Extensible Monitoring

Speed up your development. If you updated js files, the page should be reloaded. If you updated go files, the app should be recompiled, and should be restarted. And also, the page should be reloaded

Expected directory structure

+---assets
|   +- index.html
|   +- app.css
|   +- app.js
+- main.go

Usage

For example:

Run web server

$ goemon -g > goemon.yml
$ goemon go run main.go

Writing markdown

$ goemon -g md > goemon.yml
$ goemon --

Writing C code

$ goemon -g c > goemon.yml
$ goemon --

Default configuration

# Generated by goemon -g
livereload: :35730
tasks:
- match: './assets/*.js'
  commands:
  - minifyjs -m -i ${GOEMON_TARGET_FILE} > ${GOEMON_TARGET_DIR}/${GOEMON_TARGET_NAME}.min.js
  - :livereload /
- match: './assets/*.css'
  commands:
  - :livereload /
- match: './assets/*.html'
  commands:
  - :livereload /
- match: '*.go'
  commands:
  - go build
  - :restart
  - :livereload /
  • match is wildcard. You can use ./foo/bar/**/*.js like a shell.
  • commands is list of commands to run. :XXX is internal command.
Internal CommandBehavior
:livereload /pathreload path
:minifyminify js/css(work in progress)
:restartrestart app
:sleep 3000sleep 3000ms
:fizzbuzz 100do fizzbuzz(1 to 100)
:event :Foofire event :Foo

:event :Foo fire event defined - match: :Foo.

Currently, :minify is work in progress. So you should run minifyjs command to do it. For example, configuration in above works as below.

PatternBehavior
./assets/*.cssreload page
./assets/*.jsminify js/css, reload page
./assets/*.htmlreload page
./assets/*.gobuild, restart app, reload page

LiveReload

You can use livereload feature.

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <script src="http://localhost:35730/livereload.js"></script>
  <script src="/app.css"></script>
  <script src="/app.min.js"></script>
  <title>Your App</title>
</head>
<body>
<!-- Your Code -->  
</body>
</html>

Use goemon as library

cat > goemon.go
package main

import (
	_ "github.com/mattn/goemon/auto"
)
^D

Then go build. You don't need to use goemon command.

Installation

$ go get github.com/mattn/goemon/cmd/goemon

If you want to minify js, install minifyjs like below.

$ npm install -g minifyjs

License

MIT

Author

Yasuhiro Matsumoto (a.k.a mattn)