diff --git a/README.md b/README.md index f95ae84..657f117 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,15 @@ import ( "github.com/labstack/gommon/log" ) -var templatesRootDir = "testdata/tpls" +// Multiple templates paths. The first found template with a certain name is +// loaded. Convenient for themes, multidomain sites etc. +var templatesRoots = []string{"./testdata/tpls/theme","./testdata/tpls" } var filesExt = ".htm" -var logger *log.Logger //... // Once on startup. -tpls, err := gl.New(templatesRootDir, filesExt, [2]string{"<%", "%>"}, false) +tpls, err := gl.New(templatesRoots, filesExt, [2]string{"<%", "%>"}, false) if err != nil { fmt.Print("Error:", err.Error()) os.Exit(1) diff --git a/gledki_test.go b/gledki_test.go index fcce7fa..1f6ee98 100644 --- a/gledki_test.go +++ b/gledki_test.go @@ -181,7 +181,8 @@ func TestAddExecuteFunc(t *testing.T) { } } -// We put the second path as first, so files in it will be found first, if they exist. +// We put the second path as first, so files in it will be found first, if they +// exist. The test is successful if the "black" theme files are used. func TestAddExecuteFuncWithTheme(t *testing.T) { roots := []string{includePaths[1], includePaths[0]} tpls, _ := New(roots, filesExt, tagsPair, false)