Does Git recognise this folder now...?

This commit is contained in:
Azareal 2018-05-14 20:21:18 +10:00
parent 9075798128
commit a78613b63b
4 changed files with 7 additions and 6 deletions

View File

@ -5,7 +5,7 @@ import (
"../common" "../common"
"../common/alerts" "../common/alerts"
"../tmpl_gen" "../tmpl_client"
"github.com/gopherjs/gopherjs/js" "github.com/gopherjs/gopherjs/js"
) )

View File

@ -14,7 +14,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"../tmpl_gen" "../tmpl_client"
) )
type SFileList map[string]SFile type SFileList map[string]SFile
@ -41,7 +41,7 @@ func (list SFileList) JSTmplInit() error {
var fragMap = make(map[string][][]byte) var fragMap = make(map[string][][]byte)
fragMap["alert"] = tmpl.Get_alert_frags() // TODO: Add a generic fetch function, so we don't rely on the presence of the template files for this fragMap["alert"] = tmpl.Get_alert_frags() // TODO: Add a generic fetch function, so we don't rely on the presence of the template files for this
fmt.Println("fragMap: ", fragMap) fmt.Println("fragMap: ", fragMap)
return filepath.Walk("./tmpl_gen", func(path string, f os.FileInfo, err error) error { return filepath.Walk("./tmpl_client", func(path string, f os.FileInfo, err error) error {
if f.IsDir() { if f.IsDir() {
return nil return nil
} }
@ -157,7 +157,7 @@ func (list SFileList) JSTmplInit() error {
data = replace(data, "};", "}") data = replace(data, "};", "}")
data = replace(data, ";;", ";") data = replace(data, ";;", ";")
path = strings.TrimPrefix(path, "tmpl_gen/") path = strings.TrimPrefix(path, "tmpl_client/")
tmplName := strings.TrimSuffix(path, ".go") tmplName := strings.TrimSuffix(path, ".go")
fragset, ok := fragMap[strings.TrimPrefix(tmplName, "template_")] fragset, ok := fragMap[strings.TrimPrefix(tmplName, "template_")]
if !ok { if !ok {
@ -174,7 +174,7 @@ func (list SFileList) JSTmplInit() error {
path = tmplName + ".js" path = tmplName + ".js"
DebugLog("js path: ", path) DebugLog("js path: ", path)
var ext = filepath.Ext("/tmpl_gen/" + path) var ext = filepath.Ext("/tmpl_client/" + path)
gzipData := compressBytesGzip(data) gzipData := compressBytesGzip(data)
list.Set("/static/"+path, SFile{data, gzipData, 0, int64(len(data)), int64(len(gzipData)), mime.TypeByExtension(ext), f, f.ModTime().UTC().Format(http.TimeFormat)}) list.Set("/static/"+path, SFile{data, gzipData, 0, int64(len(data)), int64(len(gzipData)), mime.TypeByExtension(ext), f, f.ModTime().UTC().Format(http.TimeFormat)})

View File

@ -316,7 +316,7 @@ func CompileJSTemplates() error {
return err return err
} }
var dirPrefix = "./tmpl_gen/" var dirPrefix = "./tmpl_client/"
var wg sync.WaitGroup var wg sync.WaitGroup
var writeTemplate = func(name string, content string) { var writeTemplate = func(name string, content string) {
log.Print("Writing template '" + name + "'") log.Print("Writing template '" + name + "'")

1
tmpl_client/filler.txt Normal file
View File

@ -0,0 +1 @@
This file is here so that Git will include this folder in the repository.