eta-dev / eta

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript

Home Page:https://eta.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support a configurable template file extension

gettoarun opened this issue · comments

Is your feature request related to a problem? Please describe.
Currently, Eta supports templates with fullname + extension or it assumes an extension ".eta". This works best for most cases as files usually have an extension. But there are several files without extensions like Dockerfile, README etc, which are files that would not have an extension. This will force consumers to use read file, Eta.renderString and save file.

Describe the solution you'd like
Eta has a solid defaults / config mechanism with EtaConfig. A new defaultExtension could bring out a better defaulting for template files.
Providing an override defaultExtension: "" could help solve a no-extension file, providing defaultExtension: "jsp" or "asp" could start get interesting as well.

Describe alternatives you've considered
The only alternative i see with forced defaulting is that a consumer system adopt a

  1. Read template file without extension
  2. use Eta renderString
  3. Save template file without extension

Additional context
N/A

Closed by #266