五右卫门
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
+---assets
| +- index.html
| +- app.css
| +- app.js
+- main.goFor example:
$ goemon -g > goemon.yml
$ goemon go run main.go$ goemon -g md > goemon.yml
$ goemon --$ goemon -g c > goemon.yml
$ goemon --# 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 Command | Behavior |
|---|---|
| :livereload /path | reload path |
| :minify | minify js/css(work in progress) |
| :restart | restart app |
| :sleep 3000 | sleep 3000ms |
| :fizzbuzz 100 | do fizzbuzz(1 to 100) |
| :event :Foo | fire 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.
| Pattern | Behavior |
|---|---|
| ./assets/*.css | reload page |
| ./assets/*.js | minify js/css, reload page |
| ./assets/*.html | reload page |
| ./assets/*.go | build, restart app, reload page |
You can use livereload feature.
Your App
cat > goemon.go
package main
import (
_ "github.com/mattn/goemon/auto"
)
^DThen go build. You don't need to use goemon command.
$ go get github.com/mattn/goemon/cmd/goemonIf you want to minify js, install minifyjs like below.
$ npm install -g minifyjsMIT
Yasuhiro Matsumoto (a.k.a mattn)
暂无开放 Issues,或尚未同步最近议题。