eta-dev / eta

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
https://eta.js.org
MIT License
1.35k stars 60 forks source link

Support a configurable template file extension #265

Closed gettoarun closed 7 months ago

gettoarun commented 7 months ago

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

nebrelbug commented 7 months ago

Closed by #266