...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package asset
18
19 import (
20 "net/http"
21 "os"
22 "strings"
23
24 "github.com/shurcooL/httpfs/filter"
25 "github.com/shurcooL/httpfs/union"
26 )
27
28 var static http.FileSystem = filter.Keep(
29 http.Dir("../ui/app"),
30 func(path string, fi os.FileInfo) bool {
31 return path == "/" ||
32 path == "/script.js" ||
33 path == "/index.html" ||
34 path == "/favicon.ico" ||
35 strings.HasPrefix(path, "/lib")
36 },
37 )
38
39 var templates http.FileSystem = filter.Keep(
40 http.Dir("../template"),
41 func(path string, fi os.FileInfo) bool {
42 return path == "/" || path == "/default.tmpl" || path == "/email.tmpl"
43 },
44 )
45
46
47 var Assets http.FileSystem = union.New(map[string]http.FileSystem{
48 "/templates": templates,
49 "/static": static,
50 })
51
View as plain text