yuin / cidre-bottle

cidre-bottle: building a packaged cidre webapp binary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cidre-bottle: building a packaged cidre webapp binary

image

cidre-bottle provides an easy way to build a fat binary for web applications using the cidre webframework.

Installation

go get github.com/jteeuwen/go-bindata/...
go get github.com/elazarl/go-bindata-assetfs/...
go get github.com/yuin/cidre-bottle

Usage

directory structure:

+- assets
   +- templates
      +- page.tpl
      +- layout.tpl
   +- statics
      +- css
         +- app.css
      +- js
         +- app.js
      +- img
         +- logo.png

Runs a go-bindata command.

go-bindata assets/...

Modify cidre app codes.

app := cidre.NewApp(appConfig)
// Set a renderer with a go-bindata support
app.Hooks.Add("setup", func(w http.ResponseWriter, r *http.Request, data interface{}) {
    app.Renderer := bottle.NewHtmlTemplateRenderer(app.Renderer, Asset, AssetDir)
})

root := app.MountPoint("/")
// Serve static files
bottle.Static(root, "statics", "statics", "assets/statics", Asset, AssetDir)

License

MIT

Author

Yusuke Inuzuka

About

cidre-bottle: building a packaged cidre webapp binary

License:MIT License


Languages

Language:Go 100.0%