fiber icon indicating copy to clipboard operation
fiber copied to clipboard

🚀 [Feature]: fiber/middleware/filesystem - support for templating

Open pjebs opened this issue 1 year ago • 6 comments

Feature Description

I am embedding a html file using the filesystem middleware.

There is currently no support to add some templating. It would be good to inject some simple variables into the html file.

Additional Context (optional)

No response

Code Snippet (optional)

No response

Checklist:

  • [X] I agree to follow Fiber's Code of Conduct.
  • [X] I have checked for existing issues that describe my suggestion prior to opening this one.
  • [X] I understand that improperly formatted feature requests may be closed without explanation.

pjebs avatar Sep 19 '22 00:09 pjebs

what about this https://github.com/gofiber/template/tree/master/html#example-with-embedfs ?

ReneWerner87 avatar Sep 19 '22 12:09 ReneWerner87

It does not provide the full options and configurability of the filesystem middleware.

Eg directory listing

pjebs avatar Sep 19 '22 12:09 pjebs

It does not provide the full options and configurability of the filesystem middleware.

Eg directory listing

Can you provide an example/code snippet

efectn avatar Sep 24 '22 20:09 efectn

https://github.com/gofiber/fiber/blob/master/middleware/filesystem/filesystem.go#L38

pjebs avatar Sep 24 '22 21:09 pjebs

https://github.com/gofiber/fiber/blob/master/middleware/filesystem/filesystem.go#L38

Why to want filesystem middleware for templating? It's just for serving files

efectn avatar Sep 24 '22 21:09 efectn

The files I want to serve are mostly html files with some placeholders inside for a templating engine to substitute.

pjebs avatar Sep 24 '22 22:09 pjebs