-
Notifications
You must be signed in to change notification settings - Fork 0
/
foundation.go
52 lines (46 loc) · 1.46 KB
/
foundation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package foundation
import (
"embed"
_ "embed"
"github.com/evocert/kwe/iorw"
"github.com/evocert/kwe/resources"
)
//go:embed js/*.js
var foundationjsfs embed.FS
//go:embed js/plugins/*.js
var foundationpluginsjsfs embed.FS
//go:embed css/*.css
var foundationcssfs embed.FS
func init() {
gblrsngfs := resources.GLOBALRSNG().FS()
foundationheadhtml := iorw.NewBuffer()
gblrsngfs.MKDIR("/raw:foundation/js", foundationjsfs)
if dirs, dirserr := foundationjsfs.ReadDir("js"); dirserr == nil {
for _, dr := range dirs {
if !dr.IsDir() {
foundationheadhtml.Println(`<script type="application/javascript" src="/foundation/js/` + dr.Name() + `"></script>`)
}
}
}
gblrsngfs.MKDIR("/raw:foundation/css", foundationcssfs)
if dirs, dirserr := foundationcssfs.ReadDir("css"); dirserr == nil {
for _, dr := range dirs {
if !dr.IsDir() {
if !dr.IsDir() {
foundationheadhtml.Println(`<link rel="stylesheet" type="text/CSS" href="/foundation/css/` + dr.Name() + `">`)
}
}
}
}
gblrsngfs.MKDIR("/raw:foundation/js/plugins", foundationpluginsjsfs)
if dirs, dirserr := foundationpluginsjsfs.ReadDir("js/plugins"); dirserr == nil {
for _, dr := range dirs {
if !dr.IsDir() {
foundationheadhtml.Println(`<script type="application/javascript" src="/foundation/js/plugins/` + dr.Name() + `"></script>`)
}
}
}
gblrsngfs.MKDIR("/raw:foundation", "")
gblrsngfs.SET("/foundation/head.html", foundationheadhtml.String())
foundationheadhtml.Close()
}