3.4.0 β€’ Published 1 month ago

eta v3.4.0

Weekly downloads
39,572
License
MIT
Repository
github
Last release
1 month ago

GitHub package.json version (main) GitHub Actions Status All Contributors Coveralls Donate

You're viewing the source for Eta v3, which we just released! For v2, visit the old branch.

Summary

Eta is a lightweight and blazing fast embedded JS templating engine that works inside Node, Deno, and the browser. It's written in TypeScript and emphasizes great performance, configurability, and small bundle size.

🌟 Features

  • πŸ“¦ 0 dependencies
  • πŸ’‘ Only ~3.5 KB minzipped
  • ⚑️ Written in TypeScript
  • ✨ Deno support (+ Node and browser)
  • πŸš€ Super Fast
  • πŸ”§ Configurable
    • Plugins, custom delimiters, caching
  • πŸ”¨ Powerful
    • Precompilation, partials, async
    • Layout support!
  • πŸ”₯ Reliable
    • Better quotes/comments support
      • ex. <%= someval + "string %>" %> compiles correctly, while it fails with doT or EJS
    • Great error reporting
  • ⚑️ Exports ES Modules as well as UMD
  • πŸ“ Easy template syntax

Get Started

For more thorough documentation, visit https://eta.js.org

Install Eta

npm install eta

In the root of your project, create templates/simple.eta

Hi <%= it.name %>!

Then, in your JS file:

import { Eta } from "eta";
// import { Eta } from "https://deno.land/x/eta@v3.1.0/src/index.ts";

const eta = new Eta({ views: path.join(__dirname, "templates") });

// Render a template

const res = eta.render("./simple", { name: "Ben" });
console.log(res); // Hi Ben!

FAQs

"Eta" means tiny in Esperanto. Plus, it can be used as an acronym for all sorts of cool phrases: "ECMAScript Template Awesomeness", "Embedded Templating Alternative", etc....

Additionally, Eta is a letter of the Greek alphabet (it stands for all sorts of cool things in various mathematical fields, including efficiency) and is three letters long (perfect for a file extension).

Integrations

@shadowtime2000 created eta-vscode.

eslint-plugin-eta was created to provide an ESLint processor so you can lint your Eta templates.

Currently there is no official Webpack integration but @clshortfuse shared the loader he uses:

{
  loader: 'html-loader',
  options: {
    preprocessor(content, loaderContext) {
      return eta.render(content, {}, { filename: loaderContext.resourcePath });
    },
  },
}

To operate with Eta templates in Node-RED: @ralphwetzel/node-red-contrib-eta

Projects using eta

Contributors

Made with ❀ by @nebrelbug and all these wonderful contributors (emoji key):

This project follows the all-contributors specification. Contributions of any kind are welcome!

Credits

  • Async support, file handling, and error formatting were based on code from EJS, which is licensed under the Apache-2.0 license. Code was modified and refactored to some extent.
  • Syntax and some parts of compilation are heavily based off EJS, Nunjucks, and doT.
@docusaurus/corepipelinit-a6fbdba0bsa-core@savant/coretemplater-obsidian@infinitebrahmanuniverse/nolb-etalaravel-mix-etavlang-playground@everything-registry/sub-chunk-1618begatelm-postiche-cliechoeddripform-admineta-compilereta-ssg@phyla/templategita-ssohardhat_metamask_clienthardhat_metamask_client2esbuild-plugin-etaerdiaoidc-provider-ilkkah@toktokhan-fe/cli-plugin-gen-api-react-query@toktokhan-fe/cli-plugin-gen-img@toktokhan-fe/nodereact-svg-codegenhpr_clihtml-bundler-webpack-pluginfast-makerglypfiggoat-bot-v2racejdocfliegdoc@web3camp/hardhat-metamask-connector@aleclarson/swagger-typescript-apisaucer-appabacajp-cli-forkaak-swagger-typescript-apijson-serverjsonresume-theme-traditional@asset-toolkit/template-transform@codedungeon/gunnersexy-serverkb-generator-ts@charlytoc/learnpackapify-actor-utils@chirpy-dev/docker-cli@chirpy-dev/main-applearnpack@xitengfei/swagger-typescript-api@wynnyo/swagger-typescript-api@use-pico/sdk@1023-ventures/basalt@9paradox/apitester@vocascan/serverrn-tokriptspartan-swagger-typescript-api-generator@doremijs/a2s@docusaurus/plugin-client-redirects@docusaurus/theme-search-algolia@domore-hr/swagger-typescript-api@crockerio/app@cto.ai/ops@cto.ai/ops-rc@fr0stmourne/swagger-typescript-api@graqq/cli@galxe-protocol/galxe-protocol-sdkkoa-etaanvil-theme-cli-testanvil-theme-cli@bfrankovskyi/jscli@bhuma.dev/react-dashboard@gdquest/gweesuper-sveltekit-cliswagger2apisswagger-typescript-apiswagger-typescript-api-altswagger-typescript-api-esswagger-typescript-api-fixswagger-typescript-api-from-openai-2.0-fixswagger-typescript-api-nextgenswagger-typescript-api-ts-patchmarilenaswaggieswaggie-betasvgico@creadigme/aurelia-docgen@fliegwerk/fliegdoc-dita-theme@hydyco/emailtokriptrollup-plugin-eta@zidong/a2s@zephyr-js/config@gentrace/docusaurus-theme-search-typesensemaildown@jdpnielsen/assemblencms-ssgcreate-belt-appcreate-fastkit-app
3.4.0

1 month ago

3.3.0

1 month ago

3.2.0

5 months ago

3.1.1

8 months ago

3.0.3

10 months ago

3.0.2

10 months ago

3.1.0

9 months ago

2.2.0

11 months ago

3.0.1

11 months ago

3.0.0

11 months ago

2.1.2

12 months ago

2.1.1

12 months ago

2.1.0

12 months ago

2.0.1

1 year ago

1.14.1

1 year ago

1.14.0

1 year ago

1.13.0

1 year ago

1.14.2

1 year ago

2.0.0

1 year ago

1.12.3

3 years ago

1.12.2

3 years ago

1.12.1

3 years ago

1.12.0

3 years ago

1.11.0

4 years ago

1.10.1

4 years ago

1.9.0

4 years ago

1.10.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-beta.4

4 years ago

1.0.0-beta.3

4 years ago

1.0.0-beta.2

4 years ago

1.0.0-beta.1

4 years ago

1.0.0-beta.0

4 years ago

0.0.0

11 years ago