diff --git a/README.md b/README.md index 3d86093..798e78f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ## Go by Example -Source for the [Go by Example](https://gobyexample.com) -site. +Content and toolchain source for the +[Go by Example](https://gobyexample.com) site. ### Overview @@ -39,6 +39,16 @@ Generation requires the [`pygmentize`](http://pygments.org/) binary for syntax highlighting. +### Serving + +The site is served by the [gobyexample-server](https://github.com/mmcgrana/gobyexample-server) +tool. To export to this tool: + +```console +$ SITEDIR = ../gobyexample-server/public tool/build +``` + + ### License This work is licensed under a [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/). diff --git a/tool/generate.go b/tool/generate.go index babf717..3a6405b 100644 --- a/tool/generate.go +++ b/tool/generate.go @@ -101,6 +101,13 @@ func whichLexer(path string) string { return "" } +func whichSiteDir() { + dir := os.Getenv("SITEDIR") + if dir != "" { + siteDir = dir + } +} + func debug(msg string) { if os.Getenv("DEBUG") == "1" { fmt.Fprintln(os.Stderr, msg) @@ -228,6 +235,7 @@ func renderChapters(chapters []*Chapter) { } func main() { + whichSiteDir() ensureDir(siteDir) copyFile("template/site.css", siteDir+"/site.css") chapters := parseChapters()