Skip to content

html.Engine will stop reading templates after first error #191

@marosiak

Description

@marosiak

Hi, today I had weird issue, I have registered templates, then seen 1 error in console about one of the templates, but application didn't fail, it worked but didn't load more templates.

1.html
2.html 
3.html // Lets say this template is broken, 4 wont be loaded, but the app will behave like it's ok
4.html

How to reproduce?

htmlEngine := html.NewFileSystem(templates.GetFiles(), ".html")
	
app := fiber.New(fiber.Config{
	Views:   htmlEngine,
})

for _, v := range htmlEngine.Templates.Templates() {
	println(v.Name())
}

now create package names templates and put some html files, then in one of these files put {{ ItDoesNotExists }}
then create .go file with code below:

package templates

//go:embed *.html
var content embed.FS

func GetFiles() http.FileSystem {
	return http.FS(content)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ☢️ BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions