Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript
MIT License
Bot releases are visible (Hide)
Published by shadowtime2000 over 3 years ago
Basically updates this to use the latest Deno version, thanks to @talentlessguy for implementing that.
denoify
3aa2433Published by shadowtime2000 over 3 years ago
https://github.com/eta-dev/eta/compare/v1.12.1...v1.12.2
This is a long awaited release that removes usage for unstable APIs in the Deno build. There is a level of unstability though that would exist when using this in newer versions of Deno, but watch out for next patch releases to make it compatible with newer Deno versions.
Published by shadowtime2000 almost 4 years ago
Patched renderFileAsync
to match type definitions, reduced bundle size by 0.1KB
with usage of widely supported ternary operators.
Published by shadowtime2000 almost 4 years ago
renderAsync
and renderFileAsync
functions #49Published by nebrelbug about 4 years ago
Published by nebrelbug about 4 years ago
examples/basic.js
Published by nebrelbug about 4 years ago
processTemplate
, for processing template strings before they are parsed (PR)We realize that there have been quite a few releases lately, and we promise we'll slow down soon ๐.
Published by nebrelbug about 4 years ago
types
field to package.json
You should just be able to write
<% layout("./my-layout.eta") %>
Anywhere in your template file! my-layout.eta
will be rendered with Object.assign(it,{body:body})
, where body is the current template file.
Note: if you are using Eta in the browser, you can also use layouts. In that case, call layout
with the name of a template that has already been defined
Read here for more info about the release.
Published by nebrelbug about 4 years ago
The main feature in this change is the addition of filepath caching, added in #21.
Preliminary results show this having a GIANT performance benefit when caching is enabled!
(Using autocannon -c 100
)
Server | Cache disabled | Cache enabled: before PR | Cache enabled: after PR |
---|---|---|---|
Oak | 20k requests in 10.07s13 MB read49ms avg. latency | 48k requests in 10.07s30.9 MB read20ms avg. latency | 159k requests in 10.11s101 MB read6ms avg. latency |
Alosaur | 23k requests in 10.06s6.28 MB read42ms avg. latency | 61k requests in 10.07s16.6 MB read16ms avg. latency | 210k requests in 10.08s56.6 MB read5ms avg. latency |
Opine | 12k requests in 11.06s9.36 MB read88ms avg. latency | 28k requests in 10.07s21 MB read35ms avg. latency | 54k requests in 10.08s40.9 MB read18ms avg. latency |
Note that these servers weren't running the same templates, so don't use these results to compare the servers
The new version of Eta performs drastically better with the new PR! Alosaur, for example, served 3.3 times more data! ๐ฅ ๐ฅ ๐ฅ
Published by nebrelbug about 4 years ago
1.4.0
, we now use explicit import type
and export type
syntax. Fixed with a PR by @asos-craigmorten
Published by nebrelbug about 4 years ago
User-facing changes
"exports"
field in package.json
, meaning it should work with Skypack, Pika CDN, etc. (see https://github.com/pikapkg/skypack-cdn/issues/47).Developer changes
np
are best for now./dist
folder to .gitignore
. It is generated on locally before every build, and before release.Published by nebrelbug about 4 years ago
This version adds TypeScript declaration files. Additionally, it contains some developer improvements to the release script.
Published by nebrelbug about 4 years ago
The main change in this commit is the ability to write partials like <%~ include(...) %>
or <%~ includeFile(...) %>
in their templates in addition to <%~ E.include(...) %>
or <%~ E.includeFile(...) %>
๐ ๐ ๐
This new change should increase template readability and make transitioning to Eta seem less overwhelming. This release also includes some dev-dependency updates and the removal of some unneeded dev-dependencies.
Published by nebrelbug about 4 years ago
The main enhancement this feature brings is the ability to include partials with an absolute path! This is a feature that EJS users have been requesting for a while, but we got it first ๐ ๐.
When Eta is looking for a template with an absolute path, it will first look in config.views
, then fall back to config.root
(which is, by default, "/"
). The main advantage of this approach is that it means most users will not have to manually set config.root
(which can cause confusing problems).
Summary of other changes:
includeHelper.bind(config)
and includeFileHelper.bind(config)
statementsreadFile
function in a try {} catch {}
block, so if you pass an incorrect path to renderFile
the error will look nicerPublished by nebrelbug about 4 years ago
The most significant feature of this release is a new configure()
function that modifies Eta's base ("global") configuration. It's called like Eta.configure({tags: ["{{", "}}"]})
.
Another significant change was the decision to rename defaultConfig
to config
. The name defaultConfig
was originally chosen when I had plans to make Eta support multiple "environments", like Nunjucks. Eventually I decided this would cause unneeded complexity, but I didn't change the name. This change should not be breaking; we re-export config as defaultConfig
for backwards compatibility. In the future, use of defaultConfig
will be discouraged and we'll update the docs to reflect that.
Finally, we included a fix to renderFile
.
Notable changes (recap)
configure()
functiondefaultConfig
to config
renderFile
from erroring if the data argument is undefined or null; issue originally filed in Squirrelly by @futurelucas4502, see https://github.com/squirrellyjs/squirrelly/pull/201.Published by nebrelbug about 4 years ago
This release brings quite a few exciting updates; most notably, Deno support! ๐ ๐
It also brings a partial rewrite of Eta's file handling, many more JSDoc comments (hurrah for Intellisense!), increased testing and test coverage, and size analysis.
Notable Changes
eta.renderFile
can now accept a relative file path, as long as the views
option is setviews
option is a stringPublished by nebrelbug over 4 years ago
I added Docusaurus v2 to the list of projects using Eta. Since this gives Eta a certain amount of credibility, I decided it deserved to be published quickly.
Published by nebrelbug over 4 years ago
No code changes, just slight edits to the README. I removed one badge (the David-DM one) which often crashes or is out of date.
Published by nebrelbug over 4 years ago
This version adds support for multiple-character prefixes (ex. --
), using a parsing method already in use by Squirrelly. It also removes the necessity to RegEx-escape delimiters or prefixes.
Other changes increase code coverage, fix a compiler issue with newer versions of TypeScript, and update dependencies.
Published by nebrelbug over 4 years ago
This version adds support for the rmWhitespace
option that exists in EJS. Hopefully this will ease migration from EJS to Eta.