{"id":15097948,"url":"https://github.com/ushelp/easytemplatejs-koa","last_synced_at":"2026-02-16T14:11:50.238Z","repository":{"id":57218958,"uuid":"145061274","full_name":"ushelp/EasyTemplateJS-koa","owner":"ushelp","description":"EasyTemplateJS template engine middleware for koa!","archived":false,"fork":false,"pushed_at":"2019-08-13T06:56:53.000Z","size":592,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T05:22:08.459Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ushelp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["http://www.easyproject.cn/donation"]}},"created_at":"2018-08-17T02:22:58.000Z","updated_at":"2020-08-10T15:34:30.000Z","dependencies_parsed_at":"2022-08-28T23:22:29.284Z","dependency_job_id":null,"html_url":"https://github.com/ushelp/EasyTemplateJS-koa","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ushelp/EasyTemplateJS-koa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ushelp%2FEasyTemplateJS-koa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ushelp%2FEasyTemplateJS-koa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ushelp%2FEasyTemplateJS-koa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ushelp%2FEasyTemplateJS-koa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ushelp","download_url":"https://codeload.github.com/ushelp/EasyTemplateJS-koa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ushelp%2FEasyTemplateJS-koa/sbom","scorecard":{"id":912582,"data":{"date":"2025-08-11","repo":{"name":"github.com/ushelp/EasyTemplateJS-koa","commit":"f0595f0794d73ea8cbc7fa80d51717126e0216de"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/5 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T19:48:00.035Z","repository_id":57218958,"created_at":"2025-08-24T19:48:00.035Z","updated_at":"2025-08-24T19:48:00.035Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274125278,"owners_count":25226486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-25T16:41:32.802Z","updated_at":"2026-02-16T14:11:50.211Z","avatar_url":"https://github.com/ushelp.png","language":"JavaScript","funding_links":["http://www.easyproject.cn/donation"],"categories":[],"sub_categories":[],"readme":"# EasyTemplateJS-koa\n\n**EasyTemplateJS-koa 是基于 [EasyTemplateJS](https://github.com/ushelp/EasyTemplateJS \"EasyTemplateJS\") 的 [koa](https://koajs.com \"koa\") 框架的模板引擎中间件。**\n\n**EasyTemplateJS-koa is a template engine middleware based on [EasyTemplateJS](https://github.com/ushelp/EasyTemplateJS \"EasyTemplateJS\")  for the [koa](https://koajs.com \"koa\") framework.**\n\n\n\n## Npm install\n\n```BASH\nnpm install easytemplatejs-koa \n```\n\t\n## Usage\n\n```JS\nconst app = new Koa();\n\n// EasyTemplateJS-koa\nconst view = require('easytemplatejs-koa');\n\n// EasyTemplateJS-koa view render middleware\nview(app, {\n  cache: true,  // Whether to open the cache; default is true\n//cache: process.env.NODE_ENV == 'production',\n  enableScript:true, // enable \u003cetj-script\u003e; default is true\n  enableStyle:true, // enable \u003cetj-style\u003e; default is true\n  views: path.join(__dirname, './views'), // template file directory\n  ext: 'etj' // template file suffix\n});\n```\n\n## Demo\n\n- **app.js**\n\n\t```JS\n\tconst Koa = require('koa');\n\tconst path = require('path');\n\t\n\tconst app = new Koa();\n\t\n\t// EasyTemplateJS-koa\n\tconst view = require('easytemplatejs-koa');\n\t// EasyTemplateJS-koa view render middleware\n\tview(app, {\n\t  views: path.join(__dirname, './views'), // template file directory\n\t  ext: 'etj' // template file suffix\n\t});\n\t\n\tapp.use(async ctx =\u003e {\n\t   await ctx.render('user', {\n\t    name: 'Jay',\n\t\t\tlist:[\n\t \t\t\t{name:\"Jay\", sex:'M'},\n\t \t\t\t{name:\"Rose\", sex:'F'},\n\t \t\t\t{name:\"Anna \", sex:'F'}\n\t \t\t]\n\t  });\n\t});\n\t\n\tapp.listen(3000);\n\t```\n\n- **./views/user.etj**\n\n\t```HTML\n\t\u003ch1\u003eHello {=name}!\u003c/h1\u003e\n\t\u003cul\u003e\n\t%{\n\t\tfor(var i=0;i\u003clist.length;i++){\n\t\t\tout('\u003cli\u003e'+list[i].name+\", \"+list[i].sex+'\u003c/li\u003e');\t\n\t\t}\n\t}%\n\t\u003c/ul\u003e\n\t```\n\n## EasyTemplateJS Core Object\n\n如果需要获得 EasyTemplateJS 的核心对象进行调用，可通过中间件函数的 `.templateEngine` 属性获得。\n\nIf you need to get the core object of EasyTemplateJS to make a call, you can get it use the `.templateEngine` property of the middleware function.\n\n```JS\nconst view = require('easytemplatejs-express');\n\n// Get EasyTemplate core Object\nvar Et=view.templateEngine;\n\n// Use Et\nEt.tmplSettings={\n\t// 脚本表达式开始结束标记%{ JS script }%\n\tscriptBegin:\"%{\",\n\tscriptEnd:\"}%\",\n\t// 输出表达式开始结束标记 {name}\n\toutBegin:\"{=\",\n\toutEnd:\"}\",\n\t// 转义输出表达式开始结束标记 {-name}\n\tescapeOutBegin:\"{-\",\n\tescapeOutEnd:\"}\"\n}\n```\n\t\n## 内嵌 Script 和 CSS 支持/Embedded JavaScript and CSS\n\n```javascript\nview(app, {\n  enableScript:true, // enable \u003cetj-script\u003e; default is true\n  enableStyle:true, // enable \u003cetj-style\u003e; default is true\n  ...\n});\n```\n\n#### 中文\n\n为了增强在 Express 等服务端 Web 应用框架中使用模板的功能体验，EasyTemplateJS 开创性的为模板提供了 script 脚本和 style 样式表支持。\n- **Script 代码支持**\n\n\t将 JavaScript 代码放在 `\u003cetj-script\u003e` ... `\u003c/etj-script\u003e` 标签之间。 **语句必须使用 `;` 结尾。**\n\t\n\t\n- **CSS 代码支持**\n\t\t\n\t将 CSS 代码放在 `\u003cetj-style\u003e` ... `\u003c/etj-style\u003e` 标签之间。\n\t\n\n#### English\n\nTo enhance the functional experience of using templates in Express and other server-side Web application frameworks, EasyTemplateJS pioneered the provision of script scripts and style style sheet support for templates.\n\n- **Script code support**\n\n\tPlace the JavaScript code between the `\u003cetj-script\u003e` ... `\u003c/etj-script\u003e` tags. **The statement must end with `;`.**\n\t\n\t\n- **CSS  code support**\n\t\t\n\tPlace the CSS code between the `\u003cetj-style\u003e` ... `\u003c/etj-style\u003e` tags.\n\n\n\n\n\n\n\n## EasyTemplateJS\n\n[Documents](https://github.com/ushelp/EasyTemplateJS \"EasyTemplateJS\")\n\n\n## End\n\nEmail：\u003cinthinkcolor@gmail.com\u003e\n\n[http://www.easyproject.cn](http://www.easyproject.cn \"EasyProject Home\")\n\n\n**Donation/捐助:**\n\n\u003ca href=\"http://www.easyproject.cn/donation\"\u003e\n\u003cimg alt=\"\n支付宝/微信/QQ/云闪付/PayPal 扫码支付\" src=\"http://www.easyproject.cn/thanks/donation.png\"  title=\"支付宝/微信/QQ/云闪付/PayPal 扫码支付\"  height=\"320\" width=\"320\"\u003e\u003c/img\u003e\u003c/a\u003e\n\u003cdiv\u003e支付宝/微信/QQ/云闪付/PayPal\u003c/div\u003e\n\n\u003cbr/\u003e\n\n我们相信，每个人的点滴贡献，都将是推动产生更多、更好免费开源产品的一大步。\n\n**感谢慷慨捐助，以支持服务器运行和鼓励更多社区成员。**\n\nWe believe that the contribution of each bit by bit, will be driven to produce more and better free and open source products a big step.\n\n**Thank you donation to support the server running and encourage more community members.**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fushelp%2Feasytemplatejs-koa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fushelp%2Feasytemplatejs-koa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fushelp%2Feasytemplatejs-koa/lists"}