handled change in template extension

This commit is contained in:
thewhitetulip 2015-11-21 10:05:57 +05:30
parent 872eb2967d
commit 3a5098fcc1
1 changed files with 6 additions and 6 deletions

12
main.go
View File

@ -30,7 +30,7 @@ func main() {
files, err := ioutil.ReadDir("./templates") files, err := ioutil.ReadDir("./templates")
for _, file := range files { for _, file := range files {
filename := file.Name() filename := file.Name()
if strings.HasSuffix(filename, ".gtpl") { if strings.HasSuffix(filename, ".html") {
allFiles = append(allFiles, "./templates/"+filename) allFiles = append(allFiles, "./templates/"+filename)
} }
} }
@ -39,12 +39,12 @@ func main() {
fmt.Println(err) fmt.Println(err)
} }
templates, err = template.ParseFiles(allFiles...) templates, err = template.ParseFiles(allFiles...)
homeTemplate = templates.Lookup("home.gtpl") homeTemplate = templates.Lookup("home.html")
deletedTemplate = templates.Lookup("deleted.gtpl") deletedTemplate = templates.Lookup("deleted.html")
editTemplate = templates.Lookup("edit.gtpl") editTemplate = templates.Lookup("edit.html")
searchTemplate = templates.Lookup("search.gtpl") searchTemplate = templates.Lookup("search.html")
completedTemplate = templates.Lookup("completed.gtpl") completedTemplate = templates.Lookup("completed.html")
router := httprouter.New() router := httprouter.New()
router.GET("/", ShowAllTasks) router.GET("/", ShowAllTasks)